[SQLObject] "type checking" in SQLObject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ivo v. d. W. <iv...@am...> - 2004-06-21 15:18:31
|
Hi, I regularly run into weird problems because I'm trying to pass the wrong type of object to, for example, a foreign key. How hard would it be to make SQLObject warn in such cases? I.e. class a(SQLObject): x = StringCol() # x = dummy class b(SQLObject): x = StringCol() class c(SQLObject): x = StringCol() b = ForeignKey("b") after these declarations, SQLObject will silently allow: foo = c(x="", b=a()) (or) foo.b = a() If you have enough classes, selects(), code, etc, it's pretty easy to mixup arguments, results, classes, etc. An extra check would be very welcome. Anyone else experiencing this as well? Cheers Ivo -- Drs. I.R. van der Wijk -=- Korte Leidsedwarsstraat 12 Amaze 1017 RC Amsterdam, NL -=- T +31-20-4688336 F +31-20-4688337 Zope/Plone/Content Management W http://www.amaze.nl E in...@am... Open Source Solutions W http://vanderwijk.info E iv...@am... Consultancy PGP http://vanderwijk.info/pgp |