[registration] don't crash on import error while initializing the registry and not in debug mode
--- a/cwvreg.py Mon Oct 25 10:20:24 2010 +0200
+++ b/cwvreg.py Mon Oct 25 10:23:32 2010 +0200
@@ -462,6 +462,7 @@
def clear(self): pass
def initialization_completed(self): pass
+
class CubicWebVRegistry(VRegistry):
"""Central registry for the cubicweb instance, extending the generic
VRegistry with some cubicweb specific stuff.
@@ -559,6 +560,14 @@
if self.is_reload_needed(path):
self.reload(path)
+ def load_file(self, filepath, modname):
+ try:
+ super(CubicWebVRegistry, self).load_file(filepath, modname)
+ except ImportError:
+ if self.config.debugmode:
+ raise
+ self.exception('failed to load %s from %s', filepath, modname)
+
def reload(self, path, force_reload=True):
"""modification detected, reset and reload the vreg"""
CW_EVENT_MANAGER.emit('before-registry-reload')