27 Jul
2005
27 Jul
'05
5:26 p.m.
Nicholas Wieland wrote at 2005-7-27 13:54 +0200:
Well, not exactly - just a way to separate access to data from everything else in the product. Maybe a separate class that needs the connection as argument and that just returns the data I need in appropriate data structures by calling class methods.
class DataModel (object):
def __init__ (self, conn): self.conn = conn self.sqlFetchSomething = SQL (.....)
I think, a class variable "sqlFetchSomething" would do a better job -- unless "SQL" depends on "conn". Advantages: * fewer objects in the ZODB, fewer loads, faster operations * easier evolution of your SQL (in you need to change the SQL executed) -- Dieter