"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cloudkitty/rating/pyscripts/db/api.py" between
cloudkitty-12.1.0.tar.gz and cloudkitty-13.0.0.tar.gz

About: OpenStack CloudKitty provides Rating-as-a-Service for OpenStack.
The "Victoria" series (latest release).

api.py  (cloudkitty-12.1.0):api.py  (cloudkitty-13.0.0)
skipping to change at line 22 skipping to change at line 22
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# #
import abc import abc
from oslo_config import cfg from oslo_config import cfg
from oslo_db import api as db_api from oslo_db import api as db_api
import six import six
from cloudkitty.i18n import _
_BACKEND_MAPPING = { _BACKEND_MAPPING = {
'sqlalchemy': 'cloudkitty.rating.pyscripts.db.sqlalchemy.api'} 'sqlalchemy': 'cloudkitty.rating.pyscripts.db.sqlalchemy.api'}
IMPL = db_api.DBAPI.from_config(cfg.CONF, IMPL = db_api.DBAPI.from_config(cfg.CONF,
backend_mapping=_BACKEND_MAPPING, backend_mapping=_BACKEND_MAPPING,
lazy=True) lazy=True)
def get_instance(): def get_instance():
"""Return a DB API instance.""" """Return a DB API instance."""
return IMPL return IMPL
class NoSuchScript(Exception): class NoSuchScript(Exception):
"""Raised when the script doesn't exist.""" """Raised when the script doesn't exist."""
def __init__(self, name=None, uuid=None): def __init__(self, name=None, uuid=None):
super(NoSuchScript, self).__init__( super(NoSuchScript, self).__init__(
"No such script: %s (UUID: %s)" % (name, uuid)) _("No such script: %(name)s (UUID: %(uuid)s)") % {'name': name,
'uuid': uuid})
self.name = name self.name = name
self.uuid = uuid self.uuid = uuid
class ScriptAlreadyExists(Exception): class ScriptAlreadyExists(Exception):
"""Raised when the script already exists.""" """Raised when the script already exists."""
def __init__(self, name, uuid): def __init__(self, name, uuid):
super(ScriptAlreadyExists, self).__init__( super(ScriptAlreadyExists, self).__init__(
"Script %s already exists (UUID: %s)" % (name, uuid)) _("Script %(name)s already exists (UUID: %(uuid)s)") %
{'name': name, 'uuid': uuid})
self.name = name self.name = name
self.uuid = uuid self.uuid = uuid
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class PyScripts(object): class PyScripts(object):
"""Base class for pyscripts configuration.""" """Base class for pyscripts configuration."""
@abc.abstractmethod @abc.abstractmethod
def get_migration(self): def get_migration(self):
"""Return a migrate manager. """Return a migrate manager.
 End of changes. 3 change blocks. 
2 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)