from data.database import db
class DataModelException(Exception):
pass
class BlobDoesNotExist(DataModelException):
class InvalidEmailAddressException(DataModelException):
class InvalidOrganizationException(DataModelException):
class InvalidPasswordException(DataModelException):
class InvalidRobotException(DataModelException):
class InvalidUsernameException(DataModelException):
class TooManyUsersException(DataModelException):
class InvalidRepositoryBuildException(DataModelException):
class InvalidBuildTriggerException(DataModelException):
class InvalidTokenException(DataModelException):
class InvalidNotificationException(DataModelException):
class InvalidImageException(DataModelException):
class UserAlreadyInTeam(DataModelException):
class InvalidTeamException(DataModelException):
class InvalidTeamMemberException(DataModelException):
class TooManyLoginAttemptsException(Exception):
def __init__(self, message, retry_after):
super(TooManyLoginAttemptsException, self).__init__(message)
self.retry_after = retry_after
class Config(object):
def __init__(self):
self.app_config = None
self.store = None
config = Config()
def db_transaction():
return config.app_config['DB_TRANSACTION_FACTORY'](db)
# There MUST NOT be any circular dependencies between these subsections. If there are fix it by
# moving the minimal number of things to _basequery
# TODO document the methods and modules for each one of the submodules below.
from data.model import (blob, build, image, log, notification, oauth, organization, permission,
repository, storage, tag, team, token, user)