don't guess field if explicitly defined, rename init_rtags_category tls-sprint
authorsylvain.thenault@logilab.fr
Tue, 07 Apr 2009 19:55:38 +0200
branchtls-sprint
changeset 1277 2eeef019e186
parent 1276 f213008fad2c
child 1282 272d8ec6f308
don't guess field if explicitly defined, rename init_rtags_category
web/views/editforms.py
--- a/web/views/editforms.py	Tue Apr 07 19:55:10 2009 +0200
+++ b/web/views/editforms.py	Tue Apr 07 19:55:38 2009 +0200
@@ -186,11 +186,11 @@
     def registered(cls, registry):
         """build class using descriptor at registration time"""
         super(AutomaticEntityForm, cls).registered(registry)
-        cls.init_rtags_category()
+        cls.init_rcategories()
         return cls
         
     @classmethod
-    def init_rtags_category(cls):
+    def init_rcategories(cls):
         """set default category tags for relations where it's not yet defined in
         the category relation tags
         """
@@ -317,6 +317,11 @@
         if self.edited_entity.has_eid():
             self.edited_entity.complete()
         for rschema, role in self.editable_attributes():
+            try:
+                self.field_by_name(rschema.type, role)
+                continue # explicitly specified
+            except FieldNotFound:
+                pass # has to be guessed
             wdgname = self.rwidgets.etype_rtag(self.edited_entity.id, rschema,
                                                role)
             if wdgname: