[Zope] Override members values
Garito
garito at sistes.net
Mon Jul 10 15:58:23 EDT 2006
knitti escribió:
> On 7/10/06, Garito <garito at sistes.net> wrote:
>> __getattr__ some of you (I don't remember how exactly, sorry) have said
>> is a member to use only if there are no other way and I'm a little
>> scared for that
>
> I think there's no "official" (as in "provided by the framework")
> support for
> what you want. If you are too scared to implement some proof-of-concept
> which involves good testing covering your use case, you should think
> about another way to implement what you need.
>
> you could also use __getattribute__(), this way you can also have
> "dynamic" methods.
> http://docs.python.org/ref/new-style-attribute-access.html
>
> don't know how ZODB copes with this. or whether one needs to worry
> about that.
>
> --knitti
Hi knitti!
__getattribute__ could be good (I test it and I like the way if there
are anyone with a better one)
Now my question is:
There are any way to distinguish when the property is called by ZMI or
FTP or another "system" call (about Zope) from the property when is
called outside ZMI?
Now I have a property like:
object.Property1 = '[/some/path]'
with the __getattribute__ override I can do
print object.Property1
and the result is ok (the result of /some/path) but now if I go to
property tab of the object I can't see ['/some/path'] or raise an error
telling Property1 is not a member
What I would like to create is an object that in the ZMI has some
property values but when this properties are called the returns the
execution of the path (like macro expansion or similar)
Is this possible to do?
--
Mis Cosas
http://blogs.sistes.net/Garito
More information about the Zope
mailing list