from djblets.avatars.services.url import URLAvatarService from djblets.avatars.settings import AvatarSettingsManager from djblets.registries.registry import (ALREADY_REGISTERED, ATTRIBUTE_REGISTERED, DEFAULT_ERRORS, NOT_REGISTERED, Registry, UNREGISTER) from djblets.siteconfig.models import SiteConfiguration DISABLED_SERVICE = 'disabled_service' DISABLED_SERVICE_DEFAULT = 'disabled_service_default' UNKNOWN_SERVICE_DEFAULT = 'unknown_service_default' UNKNOWN_SERVICE_DISABLED = 'unknown_service_disabled' UNKNOWN_SERVICE_ENABLED = 'unknown_service_enabled' AVATAR_SERVICE_DEFAULT_ERRORS = DEFAULT_ERRORS.copy() AVATAR_SERVICE_DEFAULT_ERRORS.update({ ALREADY_REGISTERED: _( 'Could not register avatar service %(item)s: This service is already ' 'registered.' ), ATTRIBUTE_REGISTERED: _( 'Could not register avatar service %(attr_value)s: This service is ' 'already registered.' ), DISABLED_SERVICE: _( 'Could not fetch instance of %(service_id)s service: This service is ' 'disabled.' ), DISABLED_SERVICE_DEFAULT: _( 'Could not set the default service to %(service_id)s: This service is '
DisabledServiceError) from djblets.avatars.services.gravatar import GravatarService from djblets.registries.errors import ItemLookupError from djblets.registries.registry import (ALREADY_REGISTERED, ATTRIBUTE_REGISTERED, DEFAULT_ERRORS, NOT_REGISTERED, Registry, UNREGISTER) from djblets.siteconfig.models import SiteConfiguration DISABLED_SERVICE_DEFAULT = 'disabled_service_default' UNKNOWN_SERVICE_DEFAULT = 'unknown_service_default' UNKNOWN_SERVICE_DISABLED = 'unknown_service_disabled' UNKNOWN_SERVICE_ENABLED = 'unknown_service_enabled' AVATAR_SERVICE_DEFAULT_ERRORS = DEFAULT_ERRORS.copy() AVATAR_SERVICE_DEFAULT_ERRORS.update({ ALREADY_REGISTERED: _( 'Could not register avatar service %(item)s: This service is already ' 'registered.' ), ATTRIBUTE_REGISTERED: _( 'Could not register avatar service %(attr_value)s: This service is ' 'already registered.' ), DISABLED_SERVICE_DEFAULT: _( 'Could not set the default service to %(service_id)s: This service is ' 'disabled.' ), NOT_REGISTERED: _( 'Could not unregister unknown avatar service %(attr_value)s: This '
"""A registry for configuration forms and pages.""" from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from djblets.registries.errors import RegistrationError from djblets.registries.registry import (ALREADY_REGISTERED, ATTRIBUTE_REGISTERED, DEFAULT_ERRORS, OrderedRegistry, UNREGISTER) # Errors for ConfigPageFormRegistry CONFIG_PAGE_FORM_REGISTRY_DEFAULT_ERRORS = DEFAULT_ERRORS.copy() CONFIG_PAGE_FORM_REGISTRY_DEFAULT_ERRORS.update({ ALREADY_REGISTERED: _('Could not register form %(item)r: This form is already ' 'registered.'), ATTRIBUTE_REGISTERED: _('Could not register form %(item)r: Another form (%(duplicate)r) ' 'is already registered with %(attr_name)s = %(attr_value)s.'), }) FORM_ALREADY_REGISTERED = 'form_already_registered' # Errors for ConfigPageRegistry CONFIG_PAGE_REGISTRY_DEFAULT_ERRORS = DEFAULT_ERRORS.copy() CONFIG_PAGE_REGISTRY_DEFAULT_ERRORS.update({ ALREADY_REGISTERED: _('Could not register page %(item)s: This page is already registered.'), ATTRIBUTE_REGISTERED: _('Could not register page %(item)s: Another page (%(duplicate)s) '
"""Registry for managing feature registrations.""" from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from djblets.features.errors import FeatureConflictError, FeatureNotFoundError from djblets.registries.registry import (ALREADY_REGISTERED, ATTRIBUTE_REGISTERED, DEFAULT_ERRORS, RegistrationError, Registry, UNREGISTER) FEATURE_DEFAULT_ERRORS = DEFAULT_ERRORS.copy() FEATURE_DEFAULT_ERRORS.update({ ALREADY_REGISTERED: _( 'Could not register feature %(item)s: This feature is already ' 'registered or its ID conflicts with another feature.', ), ATTRIBUTE_REGISTERED: _( 'Could not register feature %(item)s: Another feature (%(duplicate)s) ' 'is already registered with the same feature ID.', ), UNREGISTER: _( 'Could not unregister feature %(item)s: This feature was not yet ' 'registered.', ), }) _registry = None
"""A registry for configuration forms and pages.""" from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from djblets.registries.errors import RegistrationError from djblets.registries.registry import (ALREADY_REGISTERED, ATTRIBUTE_REGISTERED, DEFAULT_ERRORS, OrderedRegistry, UNREGISTER) # Errors for ConfigPageFormRegistry CONFIG_PAGE_FORM_REGISTRY_DEFAULT_ERRORS = DEFAULT_ERRORS.copy() CONFIG_PAGE_FORM_REGISTRY_DEFAULT_ERRORS.update({ ALREADY_REGISTERED: _( 'Could not register form %(item)r: This form is already ' 'registered.' ), ATTRIBUTE_REGISTERED: _( 'Could not register form %(item)r: Another form (%(duplicate)r) ' 'is already registered with %(attr_name)s = %(attr_value)s.' ), }) FORM_ALREADY_REGISTERED = 'form_already_registered' # Errors for ConfigPageRegistry CONFIG_PAGE_REGISTRY_DEFAULT_ERRORS = DEFAULT_ERRORS.copy() CONFIG_PAGE_REGISTRY_DEFAULT_ERRORS.update({