fif inlined relation forms pb w/ new ajax forms.
We've to ensure the varmaker is properly initialized when generating
a form where we may add new subentities, which will use ajax call to
generate the subform while this subform expect a varmaker to be set.
--- a/web/request.py Tue Jan 26 13:34:12 2010 +0100
+++ b/web/request.py Tue Jan 26 13:36:55 2010 +0100
@@ -103,6 +103,17 @@
@property
def varmaker(self):
+ """the rql varmaker is exposed both as a property and as the
+ set_varmaker function since we've two use cases:
+
+ * accessing the req.varmaker property to get a new variable name
+
+ * calling req.set_varmaker() to ensure a varmaker is set for later ajax
+ calls sharing our .pageid
+ """
+ return self.set_varmaker()
+
+ def set_varmaker(self):
varmaker = self.get_page_data('rql_varmaker')
if varmaker is None:
varmaker = rqlvar_maker()
--- a/web/views/editforms.py Tue Jan 26 13:34:12 2010 +0100
+++ b/web/views/editforms.py Tue Jan 26 13:36:55 2010 +0100
@@ -590,6 +590,7 @@
form = None # no actual form wrapped
def call(self, i18nctx, **kwargs):
+ self._cw.set_varmaker()
divid = "addNew%s%s%s:%s" % (self.etype, self.rtype, self.role, self.peid)
self.w(u'<div class="inlinedform" id="%s" cubicweb:limit="true">'
% divid)