durusmail: durus-users: volatile variables vs. ComputedAttribute
volatile variables vs. ComputedAttribute
2006-02-06
2006-02-06
2006-02-06
2006-02-06
volatile variables vs. ComputedAttribute
Jeff Bauer
2006-02-06
Does Durus have anything equivalent to ZODB's
volatile "_v_" variables?

I'm aware of ComputedAttribute, which I assume
is the near-equivalent of ZODB's version.

Here's a contrived example of something I'd like
to do:

     class MostlyHarmless(Persistent):
         def set_connection(self, connection)
             self._v_connection = connection

It would be convenient during the process lifetime
for MostlyHarmless to have a connection attribute,
but it obviously can't be stored.

If this is not possible, I suppose an alternative
would be to have connection available as a global
or a module singleton and do something like this:

     import PlanetEarth

     class MostlyHarmless(Persistent):

         def _connection(self):
             return PlanetEarth.connection
         connection = ComputedAttribute(_connection)

Is this a proper Durus-ish approach?

--
Jeff Bauer      http://serpentaddiction.blogspot.com
Rubicon, Inc.   http://www.rubic.com
reply