On Thursday September 11, 2008 11:48:12 Diez B. Roggisch wrote: > On Thursday 11 September 2008 01:43:51 Gustavo Narea wrote: > > Hello, > > > > I have the following code: > > > @expose('animador.web.templates.websites.admin.edit') > > > def edit(self, website, **kwargs): > > > if pylons.tmpl_context.form_errors: > > > flash(_("Could not modify the %s web site") % website) > > > pylons.c.edit_site_form = EditWebsiteForm( > > > 'edit_site', > > > action="/websites/admin/edit_website" > > > ) > > > return dict(website=website) > > > > > > @expose('animador.web.templates.websites.admin.index') > > > @validate(form=EditWebsiteForm(), error_handler=edit) > > > def edit_website(self, old_alias, new_alias): > > > website = Website.query().get(old_alias) > > > website.website_alias = new_alias > > > DBSession.save(website) > > > DBSession.commit() > > > params = {'old': old_alias, 'new': new_alias} > > > flash(_('The "%(old)s" web site has been renamed to %(new)s!') > > > % \ params) > > > redirect('/websites/admin/') > > > > How can I make that when validation doesn't succeed in edit_website() and > > the form is then sent back to edit(), the error handler defines its > > `website` parameter? > > > > It seems like it's only called with keyword arguments. > > You can't. you need to give the same parameter-name. so either call > old_alias (I presume that's what you are after) website, or the other way > round.
OK, thank you very much! Cheers. -- Gustavo Narea. http://gustavonarea.net/ Get rid of unethical constraints! Switch to Freedomware: http://softwareliberty.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---