Did not find a how-to for your problem?

Ask me to write the how-to post by writing to the mailing-list at cps-devel [@] lists [.] nuxeo [.] com or writing to me to joseluisdelarosa+cpshowto [@] gmail [.] com. Note: I'll keep all conversations on the official mailing list.

Monday, June 4, 2007

How to implement a new product

CPS is a framework to create ECM applications. However the base bundle of CPS already comes with an example of deployment of CPS, this is the CPS Default Site object provided by the product CPSDefault. Although a CPS Default Site is completely functional out of the box, your site may require specific configuration or utilities that are not in the default site. This post will show the creation of a very basic product.

The product will be called CPSMessages and it will be the guinea pig in the next posts.

Note: The example below supposes that you have a Zope instance in the port 8080 of your localhost machine and a CPS instance in the root of Zope called cps (i.e. the url of the CPS instance should be http://localhost:8080/cps).

  1. The first thing to do to create the product is making the structure of directories in the Products folder of the Zope instance. Besides the root folder for the product called CPSMessages, let's add directories for profiles, i18n, skins and tests.

    From a console, in the root folder of Zope's instance, do:


    cd Products
    mkdir CPSMessages
    cd CPSMessages
    mkdir profiles
    mkdir i18n
    mkdir skins
    mkdir tests
    touch __init__.py
    ls
    i18n __init__.py profiles skins tests



  2. The shell of the product is ready, restart Zope and go to ZMI in Control Panel -> Product Management. There will be a list of products and among all of them there should be the brand new one called CPSMessages.

  3. Let's register now the new default profile. Edit the file __init__.py that should be in the root folder CPSMessages. The final content should look like this:


    from Products.GenericSetup import profile_registry
    from Products.GenericSetup import EXTENSION
    from Products.CPSCore.interfaces import ICPSSite

    def initialize(context):
    """
    """

    profile_registry.registerProfile(
    'default',
    'CPS Messages',
    'CPSMessages Product',
    'profiles/default',
    'CPSMessages',
    EXTENSION,
    for_= ICPSSite)



    Basically the initialize procedure calls the method registerProfile providing as parameters the identifier of the profile, name of the profile, description, path of the profile files, identifier of the product, type of profile and the interface for which this profile is available. A later post will speak about GenericSetup in detail.

  4. Restart the Zope instance and from the ZMI go now to the portal_setup tool of a CPS instance.

  5. Open the tab Profiles. There will be a new profile called CPS Messages, although for the moment, it will do nothing if you import it.

  6. Add the file import_steps.xml to the folder CPSMessages/profiles/default. This file will tell to the tool portal_setup which steps will be done when the profile is imported. The content of the file is:



    <?xml version="1.0"?>
    <import-steps>
    </import-steps>




  7. Tell it your friends, this is your first Zope/CPS product! :-)

No comments: