[entity, url] we should not set base_url in kwargs when actually unset stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 23 Sep 2010 10:48:43 +0200
branchstable
changeset 6317 0d4dd5f6f05c
parent 6316 51aa84c40a71
child 6318 de6264ac7c50
[entity, url] we should not set base_url in kwargs when actually unset
entity.py
--- a/entity.py	Thu Sep 23 10:47:54 2010 +0200
+++ b/entity.py	Thu Sep 23 10:48:43 2010 +0200
@@ -492,12 +492,13 @@
         # in linksearch mode, we don't want external urls else selecting
         # the object for use in the relation is tricky
         # XXX search_state is web specific
+        use_ext_id = False
         if 'base_url' not in kwargs and \
                getattr(self._cw, 'search_state', ('normal',))[0] == 'normal':
-            kwargs['base_url'] = self.cw_metainformation()['source'].get('base-url')
-            use_ext_id = bool(kwargs['base_url'])
-        else:
-            use_ext_id = False
+            baseurl = self.cw_metainformation()['source'].get('base-url')
+            if baseurl:
+                kwargs['base_url'] = baseurl
+                use_ext_id = True
         if method in (None, 'view'):
             try:
                 kwargs['_restpath'] = self.rest_path(use_ext_id)