no rschema attribute on widgets stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 20 May 2009 09:41:48 +0200
branchstable
changeset 1875 7bcb02377516
parent 1874 8c68a3bb02af
child 1876 b06a797448aa
no rschema attribute on widgets
web/formwidgets.py
--- a/web/formwidgets.py	Tue May 19 17:13:01 2009 +0200
+++ b/web/formwidgets.py	Wed May 20 09:41:48 2009 +0200
@@ -305,20 +305,21 @@
             values = (INTERNAL_FIELD_VALUE,)
         init_ajax_attributes(attrs, self.wdgtype, self.loadtype)
         # XXX entity form specific
-        attrs['cubicweb:dataurl'] = self._get_url(form.edited_entity)
+        attrs['cubicweb:dataurl'] = self._get_url(form.edited_entity, field)
         return name, values, attrs
 
-    def _get_url(self, entity):
-        return entity.req.build_url('json', fname=entity.autocomplete_initfuncs[self.rschema],
-                                pageid=entity.req.pageid, mode='remote')
+    def _get_url(self, entity, field):
+        fname = entity.autocomplete_initfuncs[field.name]
+        return entity.req.build_url('json', fname=fname, mode='remote',
+                                    pageid=entity.req.pageid)
 
 
 class StaticFileAutoCompletionWidget(AutoCompletionWidget):
     """XXX describe me"""
     wdgtype = 'StaticFileSuggestField'
 
-    def _get_url(self, entity):
-        return entity.req.datadir_url + entity.autocomplete_initfuncs[self.rschema]
+    def _get_url(self, entity, field):
+        return entity.req.datadir_url + entity.autocomplete_initfuncs[field.name]
 
 
 class RestrictedAutoCompletionWidget(AutoCompletionWidget):