Ian,
I thought more about my "higher-level" types and believe what I really
need are two hooks:
* afterLoad() that is called just after the object has been created from
data from the DBMS
* beforeStore() that is called just before storing data in the DBMS
By default, these don't do anything and need to be overloaded if one
wants to use them.
The following example shows how to apply this to my problem:
assume _columns contains
...
FloatCol('_ptX'),
FloatCol('_ptY'),
...
so with
def afterLoad(self):
point = Point(self._ptX, self._ptY)
I could really treat my data as being of type Point...
To make sure that storage is consistent, I'd need
def beforeStore(self):
self._ptX = self.point.x()
self._ptY = self.point.y()
The same approach obviously also solves the phoneNumber type
example...
Note that some of the attributes are probably not for direct use. I
indicated that by preceding their name with an underscore... But
maybe there is a way of having a keyword argument to Col called
'hidden' or similar such that I can only access it from the above
hook routines???
My intuition says that implementing these two hooks may be quite
straight forward or that they already exist. Can you give me some
more insight on this?
many thanks
--b
/-----------------------------------------------------------------
| Bud P. Bruegger, Ph.D.
| Sistema (www.sistema.it)
| Via U. Bassi, 54
| 58100 Grosseto, Italy
| +39-0564-411682 (voice and fax)
\-----------------------------------------------------------------
|