[Zope-CMF] Re: Add file inside CMF product during install

Raphael Ritz r.ritz at biologie.hu-berlin.de
Mon Mar 1 03:32:01 EST 2004

Steinar Eriksen wrote:
> I would like to add a file during my CMF product installation; specifically
> I would like to have a JavaScript being added via Install.py to the product
> folder after installing my product to a Plone site.
> I can manually add the script (as an external file) inside the ZMI after
> setting up my product but I would like to have it added automatically as
> part of the product install.
> Can I accomplish this somehow?

Quoting from
you can see an example in the following:

def addCMFSin(self, site_id):
     """ install the CMFSin product """

     # The installation works the same way as before:

     # Get the site ...

     site = getSite(self, site_id)

     # ... create the install method ...

         'from http://sourceforge.net/projects/collective',

     # ... and invoke it to install CMFSin.


     # Now we want to configure the tool a bit:

     # Again, we need the content of a file.
     # This time it is again located in a subdirectory
     # of the 'Extensions' folder.

     instance_home = self.Control_Panel.getINSTANCE_HOME()
     filepath = path.join(instance_home,

     cfg_content = open(filepath,'r').read()

     # Set the configuration as specified in the file:

                                    submit='Set Config')

     # 'manage_configSin' is a method of the 'SinTool' class
     # defined in Products.CMFSin.SinTool.py
     # 'submit' can be set to 'Import', 'Export', or 'Set Config'
     # to trigger different actions.
     # In the web interface this is reflected by different
     # buttons with the respective labels.

     # Finally, add the 'zope_news' slot to the right-hand side
     # of the portal's homepage by setting the value of 'right_slots'
     # completely anew here. This will only affect Plone 1 sites since
     # CMFDefault sites don't provide this property and Plone 2 has
     # a different syntax here.


     # 'manage_changeProperties' is another method of the
     # 'PropertyManager' mentioned above.


> Regards
> Steinar Eriksen
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF at zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> See http://collector.zope.org/CMF for bug reports and feature requests

More information about the Zope-CMF mailing list