[ZPT] Re: PageTemplateFile

Axel Müller axel.mueller at amit-services.de
Tue Aug 24 07:00:29 EDT 2004


Chris Withers wrote:
Hi Chris,
> Can you tell us what happens when you try?
sorry, I was completely wrong.

I need to add PageTemplateFiles to the instances of the root-folder of my
python-product. These PageTemplates should be callable via acquisition from
subfolders (other python-products) of this root. 

This wouldn't work for me, because every root-folder would have the same
"standardHeader":
-----------
class A:
 standardHeader = PageTemplateFile('Pfad/zu/standardHeader',globals())
-----------
It is making "standardHeader" a PageTemplateFile object as an
class-attribute of A.



This:
-----------
class A:
 def standardHeader(self):
 """asldfas"""
 pt = PageTemplateFile('Pfad/zu/standardHeader',globals()).__of__(self)
 return pt
-----------
isn't working at all.

This:
-----------
class A:
 def standardHeader(self):
 """asdfa"""
 pt = PageTemplateFile('Pfad/zu/standardHeader',globals()).__of__(self)
 return pt()
-----------
returns html-code. This is working for tal but of course not for metal.


This could be a solution:
----------
setattr(self,'standardHeader',PageTemplateFile('afa/standardHeader',globals())
----------
but it isn't working either:

Errortyp: StorageError
Error: Instance of AntiPersistent class PageTemplateFile cannot be
stored.


Maybe this explains my problem better than my first mail.(sorry for my
english)

thanks
axel



More information about the ZPT mailing list