Skip to content

Commit

Permalink
Move HelperError to exceptions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
TkTech committed Apr 11, 2016
1 parent 967b7b7 commit f90b9c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 13 additions & 0 deletions ckan/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# -*- coding: utf-8 -*-
class CkanException(Exception):
pass


class EmptyRevisionException(CkanException):
pass


class CkanUrlException(Exception):
pass


class CkanVersionException(Exception):
'''Exception raised by
:py:func:`~ckan.plugins.toolkit.requires_ckan_version` if the required CKAN
Expand All @@ -15,5 +19,14 @@ class CkanVersionException(Exception):
'''
pass


class CkanConfigurationException(Exception):
pass


class HelperError(Exception):
"""Raised if an attempt to access an undefined helper is made.
Normally, this would be a subclass of AttributeError, but Jinja2 will
catch and ignore them. We want this to be an explicit failure re #2908.
"""
10 changes: 1 addition & 9 deletions ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@
log = logging.getLogger(__name__)


class HelperError(Exception):
"""Raised if an attempt to access an undefined helper is made.
Normally, this would be a subclass of AttributeError, but Jinja2 will
catch and ignore them. We want this to be an explicit failure re #2908.
"""


class AttributeDict(dict):
def __init__(self, *args, **kwargs):
super(AttributeDict, self).__init__(*args, **kwargs)
Expand All @@ -67,7 +59,7 @@ def __getitem__(self, key):
try:
value = super(AttributeDict, self).__getitem__(self, key)
except AttributeError:
raise HelperError(
raise ckan.exceptions.HelperError(
'Helper \'{key}\' has not been defined.'.format(
key=key
)
Expand Down

0 comments on commit f90b9c9

Please sign in to comment.