[ZPT] Using PTFiles in Python Products

Michael R. Bernstein webmaven@lvcm.com
12 Jul 2002 17:11:06 -0700


On Fri, 2002-07-12 at 12:00, Dieter Maurer wrote:
>
> Michael R. Bernstein writes:
>  > ....
>  > > > You can try to rely on acquisition (this usually works, but may
>  > > > not work with the ubiquitous "index_html").
>  > ...
>  > Unfortunately, this does not seem to be working.
>  > 
>  > I defined a 'library' PTFile on my container, and calling a macro in it
>  > from another PTFile associated with the container works fine, but does
>  > not when I try calling the same macro from a subobject.
>  > 
>  > Now, this *may* be due to the fact that the subobjects are stored within
>  > a BTree, and are returned with an acquisition wrapper, but I can't tell.
>
> I would use Shanes "showaq" method to analyse the acquisition structure
> of these subobjects.
> 
> Apparently, there is something wrong with it. But I could not see
> a fault in your code.

Well, showaq didn't seem to be showing anything wrong, but in the course
of writing out a more detailed description of my symptoms, I discovered
the actual cause of the problem:

Here is how I had defined the PTFile:

security.declareProtected('View', 'library')
index_html = PageTemplateFile('www/weblogLibrary', globals(), __name__ =
'library')
	
When it needed to read:

library = PageTemplateFile('www/weblogLibrary', globals(), __name__ =
'library')

Everything works fine now.

Note: Although things are now functioning correctly, I am still seeing
an odd symptom. showaq gives me the following result:

http://localhost:8080/test/posting_1/library/showaq

()
|  \
|   
|   |
|   test
|   |
|   Zope
|   |
|   <RequestContainer instance at 8995258>
|

|
posting_1
|
test
|
Zope
|
<RequestContainer instance at 8995258>


In other words, the id of the 'library' PTFile is not being displayed by
the showaq method. Any ideas why (and whether this is in fact a
problem)?


Thanks for the help,

Michael Bernstein.