[Grok-dev] redirect after edit / error in docs

Henning Hraban Ramm hraban at fiee.net
Sun Oct 26 09:27:58 EDT 2008


Hello grokkers,

there's a small error in http://grok.zope.org/doc/current/grok_overview.html 
, section "grok.EditForm":

@grok.action(u"Edit species")
def edit_species(self, **data):
     self.applyData(species, **data)

What is 'species' supposed to be?


I stumbled upon that as I was trying to redirect to the index after  
editing.

My EditForm is in a viewlet and is used for a lot of similar objects:

class EditForm(grok.EditForm):
     template =  
grok.PageTemplate(filename=os.path.join('baseitem_templates',  
'edit_form.pt'))

     def __init__(self, context, request):
         super(EditForm, self).__init__(context, request)
         self.form_fields = grok.AutoFields(self.context.__class__)

     def handle_edit_action(self, **data):
         grok.EditForm.handle_edit_action(self, **data)
         self.redirect(self.url('@@index')) # FIXME: doesn't do anything

Instead of "handle_edit_action" I tried several other approaches but  
found no way for edit *and* redirect to work.

Please help?


Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)






More information about the Grok-dev mailing list