Re: [Modeling-users] ModelMasons refactored
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-04-21 16:42:42
|
Ok, I think we have a problem here w/ the 'base' generation scheme. Consider you modify the StoreEmployees model so that the classes Employee, Executive and SalesClerk are in the same module 'Employees'. This would generate: StoreEmployees |-- Address.py |-- Employees.py (Employee+Executive+SalesClerk) |-- Mark.py |-- MDL | |-- Address.py | |-- Employees.py (Employee+Executive+SalesClerk) | |-- Mark.py | |-- Store.py | |-- __init__.py | |-- model_StoreEmployees.py | `-- model_StoreEmployees.xml |-- Store.py |-- __init__.py `-- setup.py Remember that the inheritance goes like this: MDL.Employee <--- Employee <---- MDL.Executive <---- Executive 1. in MDL.__init__, we HAVE to 'import Employees' if we want to be able to write in StoreEmployees.Employees: class Employee(MDL.Employees.Employee): "..." 2. in MDL.Employees we have to write something like this: from StoreEmployees.Employees import Employee as EmployeeConcrete class Employee(CustomObject): "..." class Employee(EmployeeConcrete): "..." class SalesClerk(EmployeeConcrete): "..." The problem? It creates an import loop between packages StoreEmployees and StoreEmployees.MDL, and worse, another one between modules Employees and MDL.Employees (this problem remains even if we forget about the 'MDL' sub-directory and when all files are dropped within the same package). If someone has a solution for this, please share! I have the feeling that it is enough to state that a class and its subclass(es) should *not* share the same module when the 'base' generation scheme is involved. What do you think? -- S=E9bastien. |