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
mario ruggier
2006-02-06
On Feb 6, 2006, at 5:48 PM, David Binger wrote:

> If you are always dealing with instances that have already
> been committed to the database, you could use the
> self._p_connection value, which is already there.
>
> My personal preference is to have a global get_connection()
> that returns the value of a name in a module variable.

When working with persistent objects, whether they are as yet saved or
not, there is always some other saved persistent object handy, off
which you can get the connection, e.g.

def get_connection(saved_persistent_object):
     return saved_persistent_object._p_connection

This would be slightly different than the global get_connection() --
that would normally require some companion set_connection() to set the
global value (as in general you a module/model may not know anything
about the connection it will be used with) ?

mario

reply