sobjects/parsers.py
changeset 6970 a6ccbfbacf3d
parent 6963 5774d4ba4306
child 6975 75a232b2e477
--- a/sobjects/parsers.py	Wed Feb 09 19:00:25 2011 +0100
+++ b/sobjects/parsers.py	Thu Feb 10 12:28:31 2011 +0100
@@ -341,11 +341,11 @@
         self._cw.execute(rql, {'x': entity.eid})
 
 def registration_callback(vreg):
+    vreg.register_all(globals().values(), __name__)
     global HOST_MAPPING
-    vreg.register_all(globals().values(), __name__)
-    host_mapping_file = osp.join(vreg.config.apphome, 'hostmapping.py')
-    if osp.exists(host_mapping_file):
-        HOST_MAPPING = eval(file(host_mapping_file).read())
-        vreg.info('using host mapping %s from %s', HOST_MAPPING, host_mapping_file)
-    else:
-        HOST_MAPPING = {}
+    HOST_MAPPING = {}
+    if vreg.config.apphome:
+        host_mapping_file = osp.join(vreg.config.apphome, 'hostmapping.py')
+        if osp.exists(host_mapping_file):
+            HOST_MAPPING = eval(file(host_mapping_file).read())
+            vreg.info('using host mapping %s from %s', HOST_MAPPING, host_mapping_file)