[Zope3-Users] Error when calling addform

Florian Lindner mailinglists at xgm.de
Sun Feb 18 12:06:07 EST 2007


Am Dienstag, 13. Februar 2007 12:04 schrieb Stephan Richter:
> On Monday 12 February 2007 15:56, David Johnson wrote:
> > Many people have offered approaches.  I find the simplest and  
> > cleanest approach for declaring interfaces is as follows:
>
> The cleanest way, in my opinion, is just not to use the addform directive
> altogether. zope.formlib is the wildly accepted successor.

Ok, I've done it now if the formlib.
Do I really have to create and set all fields manually?

class BlogCommentAddForm(form.AddForm):
    form_fields = form.Fields(IBlogComment)
    
    def create(self, data):
        comment = BlogComment()
        comment.name = data["name"]
        comment.email = data["email"]
        comment.content = data["content"]
        return comment

If I just omit create is complains that the function must be implemented. Can 
this be done easier?

Thanks,

Florian


More information about the Zope3-users mailing list