[Zope-CMF] Installation script

Tres Seaver tseaver@palladion.com
Tue, 21 Aug 2001 08:15:43 -0400 (EDT)


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.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com