Re: how to "bind" product classes to flexible types ?

Lennart Regebro <[email protected]>
Newsgroups gmane.comp.web.zope.cps.devel
Message-ID <[email protected]>
Joachim Schmitz wrote:
> Hi,
> 
> In our product we use CPSFlexible Types heavily. We also define a class 
> for each Type to be able to programm specific behavior of that Type.
> 
> So we specify in our PortalTypes here is the xml-export:
> 
>  <property name="content_meta_type">StudentAdmission</property>
>  <property name="product">WAeUP_SRP</property>
>  <property name="factory">addStudentAdmission</property>
> 
> for that to work I have to specify in the products __init__.py
> 
> from Products.WAeUP_SRP.Students import StudentAdmission, 
> addStudentAdmission
> 
> and later:
> contentClasses = (list-of-Contentclasses)
> extra_constructors = (list-of-add Functions in the same order as above 
> list)
> fti = list of empty dictionarys for each ContentClass
> 
> 
> def initialize(registrar):
>     ContentInit('WAeUP Types',
>                 content_types = contentClasses,
>                 permission = AddPortalContent,
>                 extra_constructors = contentConstructors,
>                 fti = fti,
>                 ).initialize(registrar)
> 
>     # Extension profile registration
>     profile_registry.registerProfile(
>         'default',
>         'WAeUP_SRP',
>         "The WestAfrican e-University Project",
>         'profiles/default',
>         'WAeUP_SRP',
>         EXTENSION,
>         for_=ICPSSite)
> 
> Without the ContentInit I cannot access methods defined in the 
> contentclass. Isn't there a better way to do this ?

No, that looks pretty much correct. Yes, you need all that in CMF. :)

-- 
Lennart Regebro, Nuxeo     http://www.nuxeo.com/
CPS Content Management     http://www.cps-project.org/
_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.