diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-11-19 23:43:21 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-11-19 23:43:21 +0000 |
| commit | 7393c10d444cc2ed69400510fde5fb56c7c850b5 (patch) | |
| tree | 8706f72e5c57426da00755f13ba1f42a078771ef | |
| parent | 1b33116dc33074553fcbb4ac3a85f9472f6ec82f (diff) | |
| download | pyramid-7393c10d444cc2ed69400510fde5fb56c7c850b5.tar.gz pyramid-7393c10d444cc2ed69400510fde5fb56c7c850b5.tar.bz2 pyramid-7393c10d444cc2ed69400510fde5fb56c7c850b5.zip | |
Try it.
| -rw-r--r-- | repoze/bfg/configuration.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/repoze/bfg/configuration.py b/repoze/bfg/configuration.py index 16d61d367..8a78db607 100644 --- a/repoze/bfg/configuration.py +++ b/repoze/bfg/configuration.py @@ -67,7 +67,11 @@ class Configurator(object): if registry is None: registry = self.make_default_registry() self.reg = registry - self.reg['bfg_configurator'] = self # yes, a cycle; see get_configurator + try: + # yes, a cycle; see get_configurator + self.reg['bfg_configurator'] = self + except TypeError: + pass def make_default_registry(self): self.reg = Registry() @@ -98,9 +102,9 @@ class Configurator(object): manager.pop() return app - def declarative(self, root_factory, package=None, - filename='configure.zcml', settings=None, - debug_logger=None, os=os, lock=threading.Lock()): + def declarative(self, root_factory, filename='configure.zcml', + settings=None, debug_logger=None, os=os, + lock=threading.Lock()): self.make_default_registry() @@ -139,6 +143,8 @@ class Configurator(object): # site manager API directly in a different thread while we hold the # lock. Those registrations will end up in our application's # registry. + if package is None: + package = sys.modules['__main__'] lock.acquire() manager.push({'registry':self.reg, 'request':None}) try: |
