[Zope-dev] ZPT in Zope Products
    Santi Camps 
    santi at zetadb.com
       
    Thu Apr 15 04:26:18 EDT 2004
    
    
  
Wyatt Anderson escribió:
> Hello All,
>
> I am trying to use ZPT within a Zope Product I am trying to build.
>
> I want to test the container type I am addding to to determine what
>
> action to take. The following though
>
> from Products.PageTemplates.PageTemplateFile import PageTemplateFile
>
> def manage_addMyContainerForm(self, REQUEST):
>
> pt = None
>
> if self.meta_type in [‘ContainerType1’, ‘ContainerType2’]:
>
> pt = PageTemplateFile(‘zpt/addMyContainerForm’, globals())
>
> else:
>
> pt = PageTemplateFile(‘zpt/containerError’, globals())
>
> return pt.pt_render()
>
> This produces the following traceback in Zope:
>
>Traceback (innermost last):
>
>  Module ZPublisher.Publish, line 100, in publish
>
>  Module ZPublisher.mapply, line 88, in mapply
>
>  Module ZPublisher.Publish, line 40, in call_object
>
>  Module Products.MyContainer.MyContainer, line 17, in manage_addMyContainerForm
>
>  Module Products.PageTemplates.PageTemplate, line 90, in pt_render
>
>   - <PageTemplateFile at containerError>
>
>  Module Products.PageTemplates.PageTemplateFile, line 73, in pt_getContext
>
>TypeError: 'str' object is not callable
>
> I’ve checked out the code in PageTemplate.py and PageTemplateFile.py 
> and can’t
>
> figure out what is going on. The line in question is
>
> root = self.getPhysicalRoot()
>
> Is it possibly some security thing? My class is 
> setDefaultAccess(‘allow’) for now.
>
> I’ve also tried simply
>
> return pt
>
> with no traceback but without the desired results as the object is 
> returned.
>
> Thanks in advance,
>
> Wyatt
>
Try return pt()
Santi Camps
    
    
More information about the Zope-Dev
mailing list