[Zope] How to do...
Garito
garito at sistes.net
Wed Oct 18 13:17:42 EDT 2006
Andreas Jung escribió:
>
>
> --On 18. Oktober 2006 18:53:05 +0200 Garito <garito at sistes.net> wrote:
>
>> Andreas Jung escribió:
>>>
>>>
>>> --On 18. Oktober 2006 16:15:37 +0200 Garito <garito at sistes.net> wrote:
>>>
>>>> Hi all!
>>>>
>>>> How can I control the way an attribute of a product is readed?
>>>> __getattr__? __getattribute__?
>>>>
>>>> I try the __getattribute__ way but it modifies the property pages
>>>>
>>>> Example:
>>>>
>>>> I create an object instance of the product and like:
>>>>
>>>> Property1 = 'Some text'
>>>> Property2 = 2006-10-18
>>>>
>>>> I would like to call Property2 like
>>>>
>>>> object.Property2 and retrieve the data with the current locale
>>>
>>> Don't do that. Make a clear separation between the storage layer and
>>> any kind of presentation issues. If you need your internal data
>>> represented in a fancy way, write a dedicated accessor method and use
>>> this one inside your templates (or whatever) instead of accessing the
>>> data directly.
>>>
>>> -aj
>> Then I can't create a property that stores a tal expression for example?
>>
>> I would like to write things like:
>>
>> object.property = 'here/anotherproperty'
>> object.anotherproperty = 'Barcelona'
>>
>> and ask it like:
>>
>> print object.property -> 'Barcelona'
>>
>> or
>>
>> <tal:city tal:replace='here/property' /> -> 'Barcelona'
>>
>
> This posting is totally weird. Sorry, but I have really no idea
> what you're trying to do. It makes absolutely no sense.
>
> -aj
>
I only try to create a model but I'm searching the best way to create it
I try to create properties "like" this is (in the last example):
object.property "is like" object.anotherproperty
Is this possible?
--
Mis Cosas
http://blogs.sistes.net/Garito
More information about the Zope
mailing list