Nuxeo mailing list archives
[CPS-devel] how to "bind" product classes to flexible types ?
Lennart Regebro
regebro at nuxeo.com
Thu Sep 7 18:12:54 CEST 2006
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/
More information about the cps-devel
mailing list
This list archive provided by Nuxeo, the
leaders of open source ECM.
Check out the Nuxeo 5 open source,
standards-based ECM project.