summaryrefslogtreecommitdiff
path: root/factory/containers.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2016-04-02 16:11:58 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2016-04-02 16:14:41 +0200
commiteea28cce1544021f3d152782c9932a20402d6240 (patch)
tree7119e8076be32ce11972c8137fc88ce98698f875 /factory/containers.py
parent094a66fb0e6a70c15cc7cbdee5d40ba5e128c433 (diff)
downloadfactory-boy-eea28cce1544021f3d152782c9932a20402d6240.tar
factory-boy-eea28cce1544021f3d152782c9932a20402d6240.tar.gz
Refactor: move error defs to a dedicated module.
Diffstat (limited to 'factory/containers.py')
-rw-r--r--factory/containers.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/factory/containers.py b/factory/containers.py
index 0ae354b..c591988 100644
--- a/factory/containers.py
+++ b/factory/containers.py
@@ -25,13 +25,10 @@ import logging
logger = logging.getLogger(__name__)
from . import declarations
+from . import errors
from . import utils
-class CyclicDefinitionError(Exception):
- """Raised when cyclic definition were found."""
-
-
class LazyStub(object):
"""A generic container that only allows getting attributes.
@@ -93,7 +90,7 @@ class LazyStub(object):
attributes being computed.
"""
if name in self.__pending:
- raise CyclicDefinitionError(
+ raise errors.CyclicDefinitionError(
"Cyclic lazy attribute definition for %s; cycle found in %r." %
(name, self.__pending))
elif name in self.__values:
@@ -112,7 +109,6 @@ class LazyStub(object):
"The parameter %s is unknown. Evaluated attributes are %r, "
"definitions are %r." % (name, self.__values, self.__attrs))
-
def __setattr__(self, name, value):
"""Prevent setting attributes once __init__ is done."""
if not self.__initialized: