[Zope] load_site.py and zpt files

jbr@FIZ-Karlsruhe.DE jbr@FIZ-Karlsruhe.DE
Fri, 13 Sep 2002 15:50:05 +0200 (MEST)


Hello,

I am trying to enhance the load_site.py  script:

Files with suffix .zpt should be created as a zope page template file.


I am using Zope 2.5.1 on Unix, I copied  load_site.py  to load_site_fiz.py
and added the function upload_zpt


def upload_zpt(object, f):
    dir, name = os.path.split(f)
    f=open(f)


    call(object.manage_addProduct['PageTemplates'].manage_addPageTemplate( id=name, title='', text=f))



Running the modified script:  load_site_fiz.py  to upload file: test33.zpt
gives the error message:

upload_zpt test33.zpt
Traceback (most recent call last):
  File "/opt/projects/idep/zope/utilities/load_site_fiz.py", line 311, in ?
    if __name__=='__main__': main()
  File "/opt/projects/idep/zope/utilities/load_site_fiz.py", line 102, in main
    for f in files: upload_file(object, f)
  File "/opt/projects/idep/zope/utilities/load_site_fiz.py", line 121, in upload_file
    return globals()['upload_'+ext](object, f)
  File "/opt/projects/idep/zope/utilities/load_site_fiz.py", line 301, in upload_zpt
    call(object.manage_addProduct['PageTemplates'].manage_addPageTemplate( id=name, title='', text=f))
AttributeError: Function instance has no attribute '__getitem__'


Any suggestions how I should change the function upload_zpt ?

Juergen Berger