Joachim Schmitz wrote:
Hi,

Dave Kuhlman wrote:
  
I'm trying to implement a CPS Product.  I want to do this in
Python source code.  And, I'm trying to write a document on how to
do this.
    
me too ;-)
  
I'm attempting to follow the CPSSchema model, that is, I've
generated my type definition with portal_schemas, portal_layouts,
portal_types, and then pasted these (exported) definitions into:

    - skins/cps_myproduct/getMyProductSchemas.py
    - skins/cps_myproduct/getMyProductLayouts.py
    - skins/cps_myproduct/getMyProductTypes.py
    

is this naming magic ? Because I don't find any call to these scripts in
existing CPSProduct. Is this documented somewhere ?
<snipp>
  
Is there anywhere I can look for guidance?

    
I also took the MyProject-Product as an example, but
1. it is not uptodate (uses boxes)
2. there is no explanation for the naming magic also.

  
The magic name was getCustomDocument*.py (getCustomDocumentSchemas.py, getCustomDocumentLayouts.py), but how I said, it was (I think we drop this in CPS 3.3.x, I am not sure), now you can make a method like "skins/cps_myproduct/getMyProductSchemas.py" but you have to call it in your product installer like this:

        new_schemas = self.portal.getMyProductSchemas()
        self.verifySchemas(schemas = new_schemas)


Don't forget first to register your "cps_myproduct" directory into __init__.py file:

from Products.CMFCore.DirectoryView import registerDirectory
registerDirectory('cps_myproduct', globals())


and then put it at the top of cps searching directory (Extensions/install.py):
#--------------------------------------------------------------------------------------------------
from Products.CPSInstaller.CPSInstaller import CPSInstaller
class MyInstaller(CPSInstaller):
    SKINS = {
        'cps_myproduct': 'Products/MyProduct/skins/cps_myproduct',
    }

     def install(self):
         self.verifySkins(self.SKINS)
         self.resetSkinCache()

         # here you can call installNewSchemas method
         self.installNewSchemas()

    def installNewSchemas(self):
        new_schemas = self.portal.getMyProductSchemas()
        self.verifySchemas(schemas = new_schemas)

#-------------------------------------------------------------------------------------------

Cheers.

--
Alin Voinea, Nuxeo Romania
+40 21 322 19 90
http://www.nuxeo.ro
[EMAIL PROTECTED]
_______________________________________________
cps-users mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/cps-users

Reply via email to