[Zope] Adding attributes to PageTemplateFile

Chris Withers chrisw at nipltd.com
Thu Sep 11 17:06:23 EDT 2003


Carsten Gehling wrote:
> I have a product in which I have the following constructor
> 
> ------------------------------------
> software_type_list = [
>     {'value': 'OS'},
>     {'value': 'Applikation'},
>     {'value': 'Service'}
> ]
> 
> manage_addSoftwareForm = PageTemplateFile("www/software_form_add",
> globals())


> Any ideas? TIA

Simplest way I can think of is:

  software_type_list = [
      {'value': 'OS'},
      {'value': 'Applikation'},
      {'value': 'Service'}
  ]

  _addSoftwareForm = PageTemplateFile("www/software_form_add",
  globals())

  def manage_addSoftwareForm(self,*args,**kw):
    kw['software_type_list']=software_type_list
    return self._addSoftwareForm(*args,**kw)

they can then be used as:

tal:repeat="x options/software_type_list"

cheers,

Chris




More information about the Zope mailing list