Re: [ZPT] how to explore objects attributes and methods from a script or template

2011-11-07 Thread Josef Meile
Hi

> how do i get the attributes and methods list of an object?
> from a python script or a page template, dir(object) does not work?
As Fernando said it before. It is protected. One way would be to implement
an External Method, another way and perhaps much better, would  be to
implement a small python product with some security declarations in order to
avoid anonymous use of the method.

Anyway, keep in mind that expossing the "dir" method could be a security
risk. I would just adviced you to do a function which uses the "dir"-Method
and does whatever you want, but don't exposed it.

Best regards
Josef

___
ZPT mailing list
ZPT@zope.org
https://mail.zope.org/mailman/listinfo/zpt


Re: [ZPT] how to explore objects attributes and methods from a script or template

2011-11-06 Thread Fernando Martins
On 11/06/2011 02:45 PM, fg wrote:
> hi all,
>
> how do i get the attributes and methods list of an object?
> from a python script or a page template, dir(object) does not work?
>
In Python scripts you can't. It's a protected function. You can patch 
the code yourself to allow for it, but I don't remember where right now.

Fernando
___
ZPT mailing list
ZPT@zope.org
https://mail.zope.org/mailman/listinfo/zpt