[Zope-CMF] Installation script

Thomas Olsen tol@tanghus.dk
Wed, 22 Aug 2001 16:25:08 +0200


Hi

I'm afraid that I'm absolutely clueless about what you mean ;-)

What I'm doing now is something like:

if 'article' not in skinstool.objectIds():
    createDirectoryView(skinstool, 'skins/article', article_globals)
    out.write("Added 'article' directory view to portal_skins\n")

---snip------------------------
skins = skinstool.getSkinSelections()
for skin in skins:
    path = skinstool.getSkinPath(skin)
    path = map(string.strip, string.split(path,','))
    if 'article' not in path:
        try: path.insert(path.index('content'), 'article')
        except ValueError:
            path.append('article')

        path = string.join(path, ', ')
        skinstool.addSkinSelection(skin, path)
        out.write("Added 'article' to %s skin\n" % skin)
    else:
        out.write("Skipping %s skin, 'article' is already set up\n" % (
            skin))
return out.getvalue()
---snap------------------------

This works fine if I only had to add e.g. dtml skins. When I also want to add 
zptskins I cant find out which skinpaths to add them to

On Tuesday 21 August 2001 14:15, Tres Seaver wrote:
> On Tue, 21 Aug 2001, Thomas Olsen wrote:
> > I am creating a CMF based product with dtml and zpt skins. What
> > is the smartest way to create an installation script?
> >
> > I have created an exteranl method to do this but when adding
> > the skin dir to the different skin paths I dont know whether to
> > add the dtml or the zpt skin...
>
> Thomas,
>
> One way to do this is to have the script look for form variables
> in the REQUEST;  if it doesn't find them, then it returns an
> HTML page containing the form, whose action is the URL.
>
> For instance:
>
>   from Globals import HTML
>
>   FORM_TEMPLATE = HTML( """\
>   <html>
>   <body>
>   <h1> Script Parameters </h1>
>   <form action="&dtml-action;">
>   <input type="text" name="parameter"><br>
>   <input type="submit"
>   </form>
>   </body>
>   </html>""" )
>
>   def formtest( self, REQUEST ):
>       """
>       """
>
>       if REQUEST.get( 'parameter', None ) is None:
>           return FORM_TEMPLATE( None, { 'action' : self.REQUEST['URL'] } )
>       else:
>           return REQUEST
>
> Tres.

-- 
Regards,
	Thomas Olsen

http://www.tanghus.dk