[Zope] return structured result from Python scripts for page
Thu, 25 Jul 2002 17:46:08 -0400
Use an external method, and return instances of "security-aware"
classes. See the section entitled "Class Security Assertions In
Non-Product Code (External Methods/Python Scripts)" in the Zope
Developer's Guide Security chapter
I usually just return a dictionary for this purpose, though. That's
really all an instance is anyway if you don't have any methods. ;-)
Nagypal Gabor wrote:
> I tried to create external script, but this does not help. The result is
> practically the same.
> Anyway, I do not insist on creating objects. I just would like to have a
> way to return a structured result from a Python script, where I can
> access the named attributes easily. I have seen an example in a how-to,
> how to do it with dictionaries and DTML (specifying a "mapping"
> parameter for dtml-in), but it does not work for page templates (or at
> least the simple item/attribute notation does not work, and the mapping
> parameter does not exist in TALES path expressions).
> Max M wrote:
>> Gabor Nagypal wrote:
>>> I would like to return a structured result (an "object") from a
>>> Python script to use it conveniently in a page template. E.g. I would
>>> like to have a get_person Python script which gives back a person
>>> with a name and an address. Then I could use a page template like:
>> I don't think you can create objects in a Python script. You need to
>> create an external script for that.
>> Otherwise your code looks dandy.
>> regards Max M
> Zope maillist - Zope@zope.org
> ** No cross posts or HTML encoding! **
> (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
Chris McDonough Zope Corporation
"Killing hundreds of birds with thousands of stones"