more api renaming/fixing update
authorSandrine Ribeau <sandrine.ribeau@logilab.fr>
Mon, 07 Dec 2009 07:10:40 -0800
changeset 4007 91d11fda4aa0
parent 4006 c89be0bdf943
child 4009 fa4189f2cf98
child 4019 7f68077d2c3b
more api renaming/fixing update
web/uicfg.py
web/views/editcontroller.py
web/views/editforms.py
--- a/web/uicfg.py	Mon Dec 07 06:51:33 2009 -0800
+++ b/web/uicfg.py	Mon Dec 07 07:10:40 2009 -0800
@@ -356,7 +356,7 @@
             # permission which may imply rql queries
             _targetschemas = []
             for tschema in targetschemas:
-                if not rtags.etype_get(eschema, rschema, role, tschema) in categories:
+                if not tag in self.etype_get(eschema, rschema, role, tschema):
                     continue
                 rdef = rschema.role_rdef(eschema, tschema, role)
                 if not ((not strict and rdef.has_local_role(permission)) or
@@ -374,7 +374,7 @@
                     yield (rschema, targetschemas, role)
                     continue
                 if rschema.final:
-                    if not eschema.rdef(rschema).has_perm(entity._cw, permission, eid):
+                    if not eschema.rdef(rschema).has_perm(entity._cw, permission, fromeid=eid):
                         continue
                 elif role == 'subject':
                     # on relation with cardinality 1 or ?, we need delete perm as well
--- a/web/views/editcontroller.py	Mon Dec 07 06:51:33 2009 -0800
+++ b/web/views/editcontroller.py	Mon Dec 07 07:10:40 2009 -0800
@@ -70,6 +70,7 @@
         req = self._cw
         self.errors = []
         self.relations_rql = []
+        form = req.form
         # so we're able to know the main entity from the repository side
         if '__maineid' in form:
             req.set_shared_data('__maineid', form['__maineid'], querydata=True)
--- a/web/views/editforms.py	Mon Dec 07 06:51:33 2009 -0800
+++ b/web/views/editforms.py	Mon Dec 07 07:10:40 2009 -0800
@@ -169,8 +169,8 @@
 
     def should_edit_attribute(self, entity, rschema, role, form):
         rtype = str(rschema)
-        ttype = rschema.targets(entity.id, role)[0]
-        afs = uicfg.autoform_section.etype_get(entity.id, rtype, role, ttype)
+        ttype = rschema.targets(entity.__regid__, role)[0]
+        afs = uicfg.autoform_section.etype_get(entity.__regid__, rtype, role, ttype)
         if 'main_hidden' in afs or not entity.has_perm('update'):
             return False
         try: