[Zope-dev] Operation Properties.

Dieter Maurer dieter@handshake.de
Tue, 18 Sep 2001 23:45:48 +0200 (CEST)


Erik Enge writes:
 > ....
 > This raises a number of interesting issues; I'll try to be brief.
 > 
 >   - I'd like the currency-attribute itself to know about how how
 >     display itself (ie. this shouldn't be a method of the class
 >     containing the property).
 > 
 >   - I'd like the currency-attribute itself to know how to convert
 >     itself to other currencies.
 > 
 > This would allow me to say::
 > 
 >    transaction.currency.set_amount_to(100.00)
 >    transaction.currency.set_currency('FRF') # French Francs
 > 
 > And then this::
 > 
 >    transaction.currency.display_in('NOK') # Norwegian kroners
 > 
 > would render the string::
Have a look at "Date" properties.
They are already objects.

However, they are immutable. This is quite essential!
Your properties must be either immutable or persistent.
Otherwise, you risk that modifications to the properties
done without Container involvement are lost when the
object is flushed from the cache.


Dieter