after fighting for a while, i got the functionality i needed , and
integrated it with form processing

i forked pyramid_simpleform on bitbucket and refactored
`_form_reprint` into `handler_reprint`.

it was pain to figure out how to munge the response object
correctly... and i should probably change the response code to a 202
-- but this should make form processing much easier for pylons people.


    def _form_reprint( self , form , print_method ):
        form_response= print_method()
        form_response.unicode_body=
form.htmlfill(str(form_response.body))
        return form_response

    def login(self):
        if self.request.method == 'POST' :
            return self._login_submit()
        return self._login_printform()

    def _login_submit(self):
        myForm = Form( self.request , schema=LoginForm )
        if not myForm.validate():
            #return myForm.handler_reprint( self._login_printform )
            return self._form_reprint( myForm ,
self._login_printform )
        myapp.lib.helpers.do_login()
        return HTTPFound(location='/account/home')

    def _login_printform(self):
        return render_to_response('/account/login/form.mako',
{'project':'myapp'}, self.request)

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to