add some bw compat code for old rest_path prototype stable
authorsylvain.thenault@logilab.fr
Mon, 18 May 2009 14:22:26 +0200
branchstable
changeset 1842 c7a22540d6f7
parent 1841 d629a6fc33e5
child 1843 646c2dd1f03e
child 1844 ec51bf1b8be3
child 1863 9a02979a2c00
add some bw compat code for old rest_path prototype
entity.py
--- a/entity.py	Mon May 18 14:08:21 2009 +0200
+++ b/entity.py	Mon May 18 14:22:26 2009 +0200
@@ -380,7 +380,12 @@
         if getattr(self.req, 'search_state', ('normal',))[0] == 'normal':
             kwargs['base_url'] = self.metainformation()['source'].get('base-url')
         if method is None or method == 'view':
-            kwargs['_restpath'] = self.rest_path(kwargs.get('base_url'))
+            try:
+                kwargs['_restpath'] = self.rest_path(kwargs.get('base_url'))
+            except TypeError:
+                warn('%s: rest_path() now take use_ext_eid argument, '
+                     'please update' % self.id, DeprecationWarning)
+                kwargs['_restpath'] = self.rest_path()
         else:
             kwargs['rql'] = 'Any X WHERE X eid %s' % self.eid
         return self.build_url(method, **kwargs)