web/views/basecontrollers.py
branchtls-sprint
changeset 1759 61d026ced19f
parent 1736 40190717e2de
child 1760 6b97d286eb5a
--- a/web/views/basecontrollers.py	Tue May 12 18:16:11 2009 +0200
+++ b/web/views/basecontrollers.py	Tue May 12 18:53:41 2009 +0200
@@ -387,7 +387,7 @@
         except Exception, err:
             self.req.cnx.rollback()
             self.exception('unexpected error in js_validateform')
-            return (False, self.req._(str(err)))
+            return (False, self.req._(str(err).decode('utf-8')))
         return (False, '???')
 
     @jsonize
@@ -404,6 +404,17 @@
             return (success, args, None)
 
     @jsonize
+    def js_edit_relation(self, action, names, values,
+                         rtype, eid, role='subject', vid='list'):
+        success, args = self.validate_form(action, names, values)
+        if success:
+            entity = self.req.eid_rset(eid).get_entity(0, 0)
+            rset = entity.related(rtype, role)
+            return (success, args, self.view(vid, rset))
+        else:
+            return (success, args, None)
+
+    @jsonize
     def js_i18n(self, msgids):
         """returns the translation of `msgid`"""
         return [self.req._(msgid) for msgid in msgids]