Florian Lindner schrieb:
> 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?
you can do this with
def create(self, data):
comment = BlogComment()
form.applyChanges(comment, self.form_fields, data)
return comment
hth Dominique
_______________________________________________
Zope3-users mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zope3-users