[Zope] Developing customer customizable products

Peter Sabaini peter at sabaini.at
Fri Dec 5 07:59:38 EST 2003



Petter Holmström wrote:
> On pe, 2003-12-05 at 13:03, Peter Sabaini wrote:
> 
>>I'd provide a default DTMLMethod | PageTemplate file and check for a 
>>ZODB based DTMLMethod | PageTemplate object
>>
>>Sth like
>>
>>def render(self, <request, args etc.>):
>>     template = getattr(self, 'customized_pt', None)
>>     if template is None:
>>         template = self.default_pt
>>     return template(<your arguments>)
> 
>                            ^^^^                        
> What kind of arguments are we talking about here?

These are template specific (ie. different for DTML and PageTemplates). 
For DTML this eg. could be:

     template(client=self, REQUEST=self.REQUEST, foo=bar, spam=egg)

foo and spam are additional (optional) keyword args you might want to 
pass to the template

In lib/python/OFS/DTMLMethod.py , see DTMLMethod.__call__() for details


> This code:
> 
> def index_html(self, REQUEST):
>   template = DTMLFile( 'dtml/my_dtml_file', globals() )
>   return template(self, REQUEST) 
> 
> results in the following error message:
> 
>   Error Type: AttributeError
>   Error Value: aq_parent
> 
> 
> I've looked in Google and found several posts about similar problems,
> but I have not been able to find the solution to this particular
> problem.
> 
> Thanks in advance,
> 
> -Petter-
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3461 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.zope.org/pipermail/zope/attachments/20031205/7611ec0b/smime.bin


More information about the Zope mailing list