# HG changeset patch # User Florent # Date 1248812528 -7200 # Node ID 200985d3258de71afb1c9ed6797cfa4931d7370b # Parent 4608d259c3dba2cfb7200e7c00324c0fdbcc50b5 make it easy to change response of FormValidatorController diff -r 4608d259c3db -r 200985d3258d web/views/basecontrollers.py --- a/web/views/basecontrollers.py Tue Jul 07 13:57:26 2009 +0200 +++ b/web/views/basecontrollers.py Tue Jul 28 22:22:08 2009 +0200 @@ -221,18 +221,21 @@ class FormValidatorController(Controller): id = 'validateform' + def response(self, domid, status, args): + self.req.set_content_type('text/html') + jsargs = simplejson.dumps( (status, args) ) + return """""" % (domid, jsargs) + def publish(self, rset=None): self.req.json_request = True # XXX unclear why we have a separated controller here vs # js_validate_form on the json controller status, args = _validate_form(self.req, self.vreg) - self.req.set_content_type('text/html') - jsarg = simplejson.dumps( (status, args) ) domid = self.req.form.get('__domid', 'entityForm').encode( self.req.encoding) - return """""" % (domid, simplejson.dumps( (status, args) )) + return self.response(domid, status, args) class JSonController(Controller):