[Zope3-Users] nextURL not working as expected

Florian Lindner mailinglists at xgm.de
Mon Aug 7 12:06:37 EDT 2006


Am Montag, 7. August 2006 17:08 schrieb Andreas Reuleaux:
> I am using nextURL() in a similar fashion (only using create(),
> no add part) and it works fine for me, i. e. I am redirected as
> expected, see the code snippet below.
>
> I guess with the line
>
>     self.context[data["title"]] = self.link
>
> your are trying to add the object. - This is just my guess:
> You might try to add
>
>     self._finished_add = True
>
> as in the original code for add() and/or even use
>
>     zope.event.notify(ObjectCreatedEvent(ob))
>
> as in the original code for createAndAdd().


class AddLink(form.AddForm):
    form_fields = form.fields(ILink)
    
    def create(self, data):
        self.link = Link()
        self.link.title = data['title']
        self.link.description = data['description']
        self.link.URL = data['URL']
        return self.link
        
    def add(self, object):
        self.context[object.title] = object
        self._finished_add = True
        return object        
   
    def nextURL(self):
        return absoluteURL(self.link, self.request)


I've done it this way now and it seems to work.

Thanks,

Florian


More information about the Zope3-users mailing list