[server] host mapping is better named url mapping (closes #1892461) stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Tue, 02 Aug 2011 10:39:10 +0200
branchstable
changeset 7727 70ea754d3e04
parent 7726 fdae265d36e7
child 7728 0fa5ba0229cd
[server] host mapping is better named url mapping (closes #1892461)
server/sources/datafeed.py
sobjects/parsers.py
--- a/server/sources/datafeed.py	Tue Aug 02 15:52:42 2011 +0200
+++ b/server/sources/datafeed.py	Tue Aug 02 10:39:10 2011 +0200
@@ -351,10 +351,10 @@
 
     def parse(self, url):
         if url.startswith('http'):
-            from cubicweb.sobjects.parsers import HOST_MAPPING
-            for mappedurl in HOST_MAPPING:
+            from cubicweb.sobjects.parsers import URL_MAPPING
+            for mappedurl in URL_MAPPING:
                 if url.startswith(mappedurl):
-                    url = url.replace(mappedurl, HOST_MAPPING[mappedurl], 1)
+                    url = url.replace(mappedurl, URL_MAPPING[mappedurl], 1)
                     break
             self.source.info('GET %s', url)
             stream = _OPENER.open(url)
--- a/sobjects/parsers.py	Tue Aug 02 15:52:42 2011 +0200
+++ b/sobjects/parsers.py	Tue Aug 02 10:39:10 2011 +0200
@@ -459,10 +459,10 @@
 
 def registration_callback(vreg):
     vreg.register_all(globals().values(), __name__)
-    global HOST_MAPPING
-    HOST_MAPPING = {}
+    global URL_MAPPING
+    URL_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)
+        url_mapping_file = osp.join(vreg.config.apphome, 'urlmapping.py')
+        if osp.exists(url_mapping_file):
+            URL_MAPPING = eval(file(url_mapping_file).read())
+            vreg.info('using url mapping %s from %s', URL_MAPPING, url_mapping_file)