Acquisition Template
Hello, What's diference between this code? 1. tal:repeat="dirDoc here/objectValues" 2. tal:repeat="dirDoc python:container.objectValues('Folder')" This template, called "t1" and "t2" respectivaly, is in /web folder. I execute it at the same URL path /web/other/t1 and /web/other/t2. The first one gave me a /web/other folder's content, and the second gave me a /web folder's content. I didn't undestand the result of second template. How do I translate "here/objectValues" to the same code using python script? What's the code of python script could substitute "here"? -- Marco Catunda
On Tue, Jun 25, 2002 at 03:24:31PM -0300, Marco Catunda wrote:
1. tal:repeat="dirDoc here/objectValues"
'here' is like 'context' in a Python script. It's determined by the calling location (i.e., the URL).
2. tal:repeat="dirDoc python:container.objectValues('Folder')"
'container' is the actual folderish object that contains the code, in this case, the folder that contains your template. The value of container is invariant of your calling location, thus you have the results that you noted: the second example *always* gives a list of folders underneath the folder containing the template.
How do I translate "here/objectValues" to the same code using python script? What's the code of python script could substitute "here"?
Should be 'context', I think. Also, according to peterbe's DTML->ZPT translation page (www.zope.org/Members/peterbe/DTML2ZPT), it looks like tal:repeat="dirDoc python:here.objectValues('Folder')" would give a list of folders in the current context. -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
Hello Marco, Tuesday, June 25, 2002, 8:24:31 PM, you wrote: MC> What's diference between this code? MC> 1. tal:repeat="dirDoc here/objectValues" This one gives you all objects contained in the object on which the template is called. MC> 2. tal:repeat="dirDoc python:container.objectValues('Folder')" This gives you all 'Folder' objects contained in the object which contains the template itself. MC> How do I translate "here/objectValues" to MC> the same code using python script? What's MC> the code of python script could substitute MC> "here"? 'context' in script(python) is the same as 'here' in ZPTs. in a script(python) you would write: context.objectValues() to get the same result as here/objectValues in ZPT -- Geir Bækholt web-developer geirh@funcom.com funcom oslo | webdev-team
But in python expression in ZPT 'context.objectValues' doesn't exist. Why? I have to use 'here.objectValues'. I think it doesn't make sense... -- Marco Catunda On Tue, 2002-06-25 at 16:57, Geir Bækholt wrote:
'context' in script(python) is the same as 'here' in ZPTs.
in a script(python) you would write: context.objectValues() to get the same result as here/objectValues in ZPT
Marco Catunda writes:
But in python expression in ZPT 'context.objectValues' doesn't exist. Why? I have to use 'here.objectValues'. I think it doesn't make sense... You see here the struggle to get the terminology right.
It is not so easy to find a good term for what is called self in External Methods context in Python Scripts here in Page Templates Each time, the Zope developers notice that many Zope users still have problems to grasp the term, and choose another one... Me, too, I do not know a good term. Do you? Dieter
A good term is really hard to find. But, in Zope we have two terminology to do the same thing context - in Python Scripts here - in Page Templates It does't matter how the term is good or not, but I think Zope should use the same term. Do you know why 'here' is use in Page Templates instead of 'context'? -- Marco Catunda On Thu, 2002-06-27 at 15:06, Dieter Maurer wrote:
Marco Catunda writes:
But in python expression in ZPT 'context.objectValues' doesn't exist. Why? I have to use 'here.objectValues'. I think it doesn't make sense... You see here the struggle to get the terminology right.
It is not so easy to find a good term for what is called
self in External Methods context in Python Scripts here in Page Templates
Each time, the Zope developers notice that many Zope users still have problems to grasp the term, and choose another one...
Me, too, I do not know a good term. Do you?
Dieter
Marco Catunda writes:
A good term is really hard to find.
But, in Zope we have two terminology to do the same thing context - in Python Scripts here - in Page Templates
It does't matter how the term is good or not, but I think Zope should use the same term. Do you know why 'here' is use in Page Templates instead of 'context'?
I do not know precisely. I expect that "context" confused many users and the Page Template authors tried to find a better term... Dieter
participants (4)
-
Dieter Maurer -
Geir Bækholt -
Marco Catunda -
Mike Renfro