|
From: Luke O. <lu...@me...> - 2003-04-29 19:15:36
|
> As long as you make your classes part of a module, I don't see this
> being a problem, since the class names are all stored up when you
> define
> the class, which will happen whether you import 1, 2, or all the
> classes
> in a module.
I'm not quite following: Here's the full example that with
SQLObject's current classRegistry/string-defined FKs will lead to
third-part classes needing to import things they don't directly know
about:
------ Person.py
class Person(SQLObject):
_columns = [StringCol(\'name\')]
_joins = [MultipleJoin(\'Cat\')]
------ Cat.py
class Cat(SQLObject):
_columns = [StringCol('name'), KeyCol('person_id',
foreignKey='Person')]
------ MyApp.py
from Person import Person
peep = Person(1)
for cat in peep.cats: # error because Cat has not been imported.
print cat
------ END
I really dislike having to import Cat in MyApp.py (which solves the
problem), since it's not explicitly used, and there's no reason MyApp
should even know where to import it from. Of course, neither does
SQLObject, so I don't have a solution.
- Luke
--
i find your contempt for naked feet curious.
|