--- a/web/request.py Wed Apr 29 19:48:27 2009 +0200
+++ b/web/request.py Wed Apr 29 19:50:04 2009 +0200
@@ -23,7 +23,7 @@
from cubicweb.common.uilib import remove_html_tags
from cubicweb.utils import SizeConstrainedList, HTMLHead
from cubicweb.web import (INTERNAL_FIELD_VALUE, LOGGER, NothingToEdit, RequestError,
- StatusResponse)
+ StatusResponse)
_MARKER = object()
--- a/web/views/autoform.py Wed Apr 29 19:48:27 2009 +0200
+++ b/web/views/autoform.py Wed Apr 29 19:50:04 2009 +0200
@@ -20,7 +20,7 @@
class AutomaticEntityForm(EntityFieldsForm):
"""base automatic form to edit any entity.
- Designed to be flly generated from schema but highly configurable through:
+ Designed to be fully generated from schema but highly configurable through:
* rtags (rcategories, rfields, rwidgets, inlined, rpermissions)
* various standard form parameters
--- a/web/views/basecontrollers.py Wed Apr 29 19:48:27 2009 +0200
+++ b/web/views/basecontrollers.py Wed Apr 29 19:50:04 2009 +0200
@@ -395,6 +395,8 @@
def js_edit_field(self, action, names, values, rtype, eid):
success, args = self.validate_form(action, names, values)
if success:
+ # Any X,N where we don't seem to use N is an optimisation
+ # printable_value won't need to query N again
rset = self.req.execute('Any X,N WHERE X eid %%(x)s, X %s N' % rtype,
{'x': eid}, 'x')
entity = rset.get_entity(0, 0)
@@ -402,9 +404,17 @@
else:
return (success, args, None)
-# def js_rql(self, rql):
-# rset = self._exec(rql)
-# return rset and rset.rows or []
+ @jsonize
+ def js_edit_relation(self, action, names, values,
+ rtype, eid, role='subject', vid='list'):
+ # XXX validate_form
+ success, args = self.validate_form(action, names, values)
+ if success:
+ entity = self.req.eid_rset(eid).get_entity(0, 0)
+ rset = entity.related('person_in_charge', role)
+ return (success, args, self.view(vid, rset))
+ else:
+ return (success, args, None)
@jsonize
def js_i18n(self, msgids):