# HG changeset patch # User Sylvain Thénault # Date 1297337311 -3600 # Node ID a6ccbfbacf3d9c25374b093b5edd814e2051bb8f # Parent c527de85ea61fd3acb5bb0943a7f164988e235c0 [parser host mapping] take care to cases where apphome is None (c-c i18ncube command for instance) diff -r c527de85ea61 -r a6ccbfbacf3d sobjects/parsers.py --- 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)