--- a/web/views/ajaxedit.py Thu Apr 30 17:36:17 2009 +0200
+++ b/web/views/ajaxedit.py Thu Apr 30 17:36:33 2009 +0200
@@ -6,6 +6,7 @@
"""
__docformat__ = "restructuredtext en"
+from cubicweb import role
from cubicweb.selectors import match_form_params, match_kwargs
from cubicweb.web.box import EditRelationBoxTemplate
@@ -24,7 +25,7 @@
expected_kwargs = form_params = ('rtype', 'target')
build_js = EditRelationBoxTemplate.build_reload_js_call
-
+
def cell_call(self, row, col, rtype=None, target=None, etype=None):
self.rtype = rtype or self.req.form['rtype']
self.target = target or self.req.form['target']
@@ -41,7 +42,7 @@
fakebox = []
self.w(u'<div id="%s">' % self.id)
self.w(u'<h1>%s</h1>' % self.req._('relation %(relname)s of %(ent)s')
- % {'relname': rschema.display_name(self.req, self.xtarget()[0]),
+ % {'relname': rschema.display_name(self.req, role(self)),
'ent': entity.view('incontext')})
self.w(u'<ul>')
self.w_unrelated(fakebox, entity)
@@ -55,15 +56,16 @@
if etype is not defined on the Box's class, the default
behaviour is to use the entity's appropraite vocabulary function
"""
- x, target = self.xtarget()
# use entity.unrelated if we've been asked for a particular etype
if getattr(self, 'etype', None):
- rset = entity.unrelated(self.rtype, self.etype, x, ordermethod='fetch_order')
+ rset = entity.unrelated(self.rtype, self.etype, role(self),
+ ordermethod='fetch_order')
self.pagination(self.req, rset, w=self.w)
return rset.entities()
# in other cases, use vocabulary functions
entities = []
- for _, eid in entity.vocabulary(self.rtype, x):
+ # XXX to update for 3.2
+ for _, eid in entity.vocabulary(self.rtype, role(self)):
if eid is not None:
rset = self.req.eid_rset(eid)
entities.append(rset.get_entity(0, 0))