Mailing List Archive

Re: Zope Digest, Vol 127, Issue 3
Thanks both. .body() is the simple answer, .read() also works.
Rich

----
>
> Message: 1
> Date: Wed, 13 May 2015 11:36:03 +0000
> From: Rich Harley <raharley0@gmail.com>
> To: zope@zope.org
> Subject: [Zope] Iterating over objects in ZODB
> Message-ID: <86A3FE9B-5060-4D9A-B5BA-7F96AACD7361@gmail.com>
> Content-Type: text/plain; charset=windows-1252
>
> When iterating over dtml objects, the contents of those scripts can be returned:
>
> e.g.
>
> for item in context.objectValues():
> if item.meta_type=='DTML Method?:
> print item
>
>
> But when iterating over Python Scripts, only:
>
> <PythonScript at handleday>
>
> is returned. How can I access the actual contents of the Python Script?
>
> Thanks
> Rich
>
> ------------------------------
>
> Message: 2
> Date: Wed, 13 May 2015 13:57:30 +0200
> From: Niels Dettenbach <nd@syndicat.com>
> To: zope@zope.org
> Subject: Re: [Zope] Iterating over objects in ZODB
> Message-ID: <2201822.Nhz8cIhMP1@gongo>
> Content-Type: text/plain; charset="us-ascii"
>
> Am Mittwoch, 13. Mai 2015, 11:36:03 schrieb Rich Harley:
>> is returned. How can I access the actual contents of the Python Script?
> The python script object seems a bit more complex then a DTML-Method object -
> means you have to access the script content of the python script object
> directly (not shure if it's "params" and "body" - have to look into Zope help
> (PythonScript.py) or Zope sources for the exact "field").
>
> regarduing the object docs it shoudl work with .read() directly (if it IS a
> PythonScript object) or "document_src":
>
> def read():
> """
>
> Return the body of the Python Script, with a special comment
> block prepended. This block contains meta-data in the form of
> comment lines as expected by the 'write' method.
>
> """
> def document_src(REQUEST=None, RESPONSE=None):
> """
>
> Return the text of the 'read' method, with content type
> 'text/plain' set on the RESPONSE.
>
> """
>
>
> hth a bit and works,
>
>
> Niels.
> --
> ---
> Niels Dettenbach
> Syndicat IT & Internet
> http://www.syndicat.com
> PGP: https://syndicat.com/pub_key.asc
> ---
>
>
>
>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: signature.asc
> Type: application/pgp-signature
> Size: 819 bytes
> Desc: This is a digitally signed message part.
> URL: <http://mail.zope.org/pipermail/zope/attachments/20150513/3755648d/attachment-0001.sig>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 13 May 2015 12:02:12 GMT
> From: "Fernando" <fernando@cmartins.nl>
> To: "Niels Dettenbach" <nd@syndicat.com>
> Cc: zope@zope.org
> Subject: Re: [Zope] Iterating over objects in ZODB
> Message-ID: <1431518532918.105147.15916@webmail6>
> Content-Type: text/plain; charset="utf-8"
>
> obj.body()
>
>
> On 13 May 2015, Niels Dettenbach <nd@syndicat.com> wrote:
>> Am Mittwoch, 13. Mai 2015, 11:36:03 schrieb Rich Harley:
>>> is returned. How can I access the actual contents of the Python Script?
>>> The python script object seems a bit more complex then a DTML-Method object -
>> means you have to access the script content of the python script object
>> directly (not shure if it's "params" and "body" - have to look into Zope help
>> (PythonScript.py) or Zope sources for the exact "field").
>>
>> regarduing the object docs it shoudl work with .read() directly (if it IS a
>> PythonScript object) or "document_src":
>>
>> def read():
>> """
>>
>> Return the body of the Python Script, with a special comment
>> block prepended. This block contains meta-data in the form of
>> comment lines as expected by the 'write' method.
>>
>> """
>> def document_src(REQUEST=None, RESPONSE=None):
>> """
>>
>> Return the text of the 'read' method, with content type
>> 'text/plain' set on the RESPONSE.
>>
>> """
>>
>>
>> hth a bit and works,
>>
>>
>> Niels.
>> --
>> ---
>> Niels Dettenbach
>> Syndicat IT & Internet
>> <http://www.syndicat.com>
>> PGP: <https://syndicat.com/pub_key.asc>
>> ---
>>
>>
>>
>>
>>
>> _______________________________________________
>> Zope maillist - Zope@zope.org
>> <https://mail.zope.org/mailman/listinfo/zope>
>> ** No cross posts or HTML encoding! **
>> (Related lists -
>> <https://mail.zope.org/mailman/listinfo/zope-announce>
>> <https://mail.zope.org/mailman/listinfo/zope-dev> )
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.zope.org/pipermail/zope/attachments/20150513/d49b91d5/attachment-0001.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Zope maillist - Zope@zope.org
>
>
>
> ------------------------------
>
> End of Zope Digest, Vol 127, Issue 3
> ************************************

_______________________________________________
Zope maillist - Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )