Skip to content

Commit

Permalink
[#1841] define NameConflict error instead of using Excepion itself
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Aug 7, 2014
1 parent 938117a commit 683c7ff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ckan/logic/__init__.py
Expand Up @@ -16,6 +16,10 @@
_validate = df.validate


class NameConflict(Exception):
pass


class AttributeDict(dict):
def __getattr__(self, name):
try:
Expand Down Expand Up @@ -377,7 +381,7 @@ def get_action(action):
for plugin in p.PluginImplementations(p.IActions):
for name, auth_function in plugin.get_actions().items():
if name in resolved_action_plugins:
raise Exception(
raise NameConflict(
'The action %r is already implemented in %r' % (
name,
resolved_action_plugins[name]
Expand Down Expand Up @@ -628,7 +632,7 @@ def get_validator(validator):
for plugin in p.PluginImplementations(p.IValidators):
for name, validator in plugin.get_validators().items():
if name in _validators_cache:
raise Exception(
raise NameConflict(
'The validator %r is already defined' % (name,)
)
log.debug('Validator function {0} from plugin {1} was inserted'.format(name, plugin.name))
Expand Down Expand Up @@ -675,7 +679,7 @@ def get_converter(converter):
for plugin in p.PluginImplementations(p.IConverters):
for name, converter in plugin.get_converters().items():
if name in _converters_cache:
raise Exception(
raise NameConflict(
'The converter %r is already defined' % (name,)
)
log.debug('Converter function {0} from plugin {1} was inserted'.format(name, plugin.name))
Expand Down

0 comments on commit 683c7ff

Please sign in to comment.