[Zope-dev] Operation Properties.

Erik Enge erik@thingamy.net
17 Sep 2001 19:13:58 +0200


'Evening, Zopistas.

I'm developing an accounting product right now, and one of the more
interesting aspects of how to solve this issue is how do handle
currencies.  I've decided to let each entry (transaction) know about
the currency it was in.  At a later stage, the user is given the
option to convert the currency to something else, but only for
display-purposes and nothing persistent.

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::

   NOK 125.00

for example.  Or::

   transaction.currency.convert_to('NOK')

would render the float::

   125.00

or something like that.  I'm not entierly sure of the API, yet.

The point is, I'd like to delegate attribute-behaviour to the
attribute itself.  Currently, I don't see any easy way to do this with
Zope.  I gather that there isn't either, based on the links I give
below.  It seems that many projects are implementing their own
property-handling.

Summarizing: I'd like to volunteer time to a project/proposal that
would take care of properties once and for all.  I'm proposing to
create a new property model where we have "pluggable" properties that
is more lously coupled with the management of properties and allows
the developer to add custom-made properties (much like
PlugginIndexes).

I also propose to make the property itself know how to render a widget
for it, given an environment.  A property of type 'date', for example,
could render six HTML select-lists given a HTML-environment (year,
month, day, hour, minute (second, maybe), timezone).

The functionality of these widgets should be a separated from the
properties, naturally.  It should also be pluggable.  I'm thinking
pluggable in a site-wide context here.

Whatchya think?

http://warp-framework.sf.net/
http://demo.iuveno-net.de/iuveno/Products/SmartObjects/
http://www.zope.org/Members/faassen/Formulator/
http://dev.zope.org/Wikis/DevSite/Proposals/PropertyRevamp/
http://dev.zope.org/Wikis/DevSite/Proposals/PropertyManagerEvents/