diff options
| author | Chris McDonough <chrism@plope.com> | 2010-12-09 08:48:27 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2010-12-09 08:48:27 -0500 |
| commit | 4a5f9df2c6ecfaea37c231f5c5aa48b92e1b59ad (patch) | |
| tree | ca9aa7b42679cb3145129c75fdf2158ec1dbd706 | |
| parent | 33d98b7222141a69a2a33a46e909b8a631fa609c (diff) | |
| download | pyramid-4a5f9df2c6ecfaea37c231f5c5aa48b92e1b59ad.tar.gz pyramid-4a5f9df2c6ecfaea37c231f5c5aa48b92e1b59ad.tar.bz2 pyramid-4a5f9df2c6ecfaea37c231f5c5aa48b92e1b59ad.zip | |
docs fixes; simplify include implementation
| -rw-r--r-- | pyramid/config.py | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/pyramid/config.py b/pyramid/config.py index 25f4f9aaf..8b4cb0236 100644 --- a/pyramid/config.py +++ b/pyramid/config.py @@ -404,7 +404,8 @@ class Configurator(object): respectively, which are passed to ``callable`` when this action is executed. - ``order`` is a crude order control mechanism, only rarely used. + ``order`` is a crude order control mechanism, only rarely used (has + no effect when autocommit is ``True``). """ if kw is None: kw = {} @@ -430,11 +431,11 @@ class Configurator(object): context.action(discriminator, callable, args, kw, order) def commit(self): - """ Commit any pending configuration actions added. If a - configuration conflict has occurred, this method will raise a - :exc:`ConfigurationConflictError`; within the traceback of this error - will be information about the source of the conflict, usually - including file names and line numbers of the cause of the + """ Commit any pending configuration actions. If a configuration + conflict is detected in the pending configuration actins, this method + will raise a :exc:`ConfigurationConflictError`; within the traceback + of this error will be information about the source of the conflict, + usually including file names and line numbers of the cause of the configuration conflicts.""" if self._ctx is None: return @@ -490,27 +491,22 @@ class Configurator(object): configuration conflict by registering something with the same configuration parameters.""" - sourcefiles = [] + _context = self._ctx + if _context is None: + _context = self._ctx = self._make_context(self.autocommit) for c in callables: c = self.maybe_dotted(c) sourcefile = inspect.getsourcefile(c) module = inspect.getmodule(c) - sourcefiles.append((sourcefile, c, module)) - - _context = self._ctx - if _context is None: - _context = self._ctx = self._make_context(self.autocommit) - - for filename, func, module in sourcefiles: - spec = module.__name__ + ':' + func.__name__ + spec = module.__name__ + ':' + c.__name__ if _context.processSpec(spec): context = GroupingContextDecorator(_context) - context.basepath = os.path.dirname(filename) + context.basepath = os.path.dirname(sourcefile) context.includepath = _context.includepath + (spec,) context.package = package_of(module) config = self.__class__.with_context(context) - func(config) + c(config) @classmethod def with_context(cls, context): |
