[parser host mapping] take care to cases where apphome is None (c-c i18ncube command for instance)
--- 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)