[Zope] using formlib for nonclasic content types

Roberto Allende rover at menttes.com
Thu Jan 28 02:40:35 EST 2010


Hello

Following example 18.3.1 and 18.3.2 from phillkon's book, i'm trying to 
define a MySite class in Zope 2.12, which look like this:


  class IMySite(IPossibleSite, IContainer):
     """
     """
     id = ASCIILine( ...
     name = TextLine( ...


  class MySite(SiteManagerContainer, BTreeContainer):
      implements(IMySite)

So far so good, i've an interface and a class extending 
SiteManagerContainer and BTreeContainer. Problem becomes when i want to 
define the add form. If i'm not wrong, I cannot use the same machinery 
as zope3, so i was trying to use formlib:

  class MySiteAddForm(AddForm):
      form_fields=form.Fields(IListo)

And i doesn't work. The error i'm getting is:

NotImplementedError: concrete classes must implement create() or 
createAndAdd()

I was looking info about them but i wonder i'm running with a conceptual 
gap here, because this is the same problem i had to define MySite 
inheriting from Folder. The same problem happened there, i was able to 
define the class but when i needed the form i wasn't able to use formlib 
and i used old-zope2-like-code. Probably i could try to do smt like 
that, but i'm very curious to see how can i use formlib in such cases.

The question then is, is it possible or would it make sense to do 
something like this ?. Do you know about a sample code that could be 
helpful ?.

Any comment or hint would be very appreciated.

Kind Regards
r.

-- 
http://robertoallende.com



More information about the Zope mailing list