[CPS-devel] howto create a Python script in the root by portal_setup

Georges Racinet gracinet at nuxeo.com
Mon Sep 18 16:19:34 CEST 2006


On Sep 18, 2006, at 1:26 PM, Joachim Schmitz wrote:

> I want to create the pythonscript .cpsskins_theme, which sets the  
> theme for display, by importing the profile.
>
> I tried :
>
>  <script script_id=".cpsskins_theme"
>          type="Script (Python)"
>          filename="roots/.cpsskins_theme.py"
>          />
>
> in roots.xml, the import finishes without error, but the script is  
> not created.

The XMLRootsAdapted treats <object> tags only (see below). It's there  
to initialize first level folder documents (e.g., sections,  
workspaces, members)
That being said:
  - if you want to use a site wide .cpsskins_theme script, just put  
it in the skins (the skins are always looked up at the end of  
acquisition, hence it's still overridable
  - if you want to put one in a particular root, use the <object> tag  
(as in most of these xml files) with the meta_type of scripts (Python)

Note also that since a recent improvent  by Olivier, the  
RootXMLAdapter can actually create a whole hierarchy (it's now  
recursive), so you should be able to put local themes everywhere :-)
Unfortunately, it doesn't load properties, so that you have to use  
scripts, even for static theme pages overrides.

class RootsXMLAdapter(XMLAdapterBase):
     _LOGGER_ID = 'roots'
     name = 'roots'

     (...)

     def _initRoots(self, node):
         site = self.context
         for child in node.childNodes:
             if child.nodeName != 'object':
                 continue

     (...)


>
>
> -- 
> Gruß Joachim
>
>
>
> _______________________________________________
> cps-devel mailing list
> http://lists.nuxeo.com/mailman/listinfo/cps-devel

---------
Georges Racinet                        Nuxeo SAS
gracinet at nuxeo.com                http://nuxeo.com
Tel: +33 (0) 1 40 33 71 73





This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.