Ticket #309 (closed defect: fixed)
[PATCH] sql_class from BaseDataController can't be overriden via inheritance
|Reported by:||alberto@…||Owned by:||anonymous|
I've created my own datacontrollers by subclassing BaseDataController? and I'd like to be able to override sql_class but the current implementation doesn't allow that as it raises a ValueError? if sql_class isn't passed as a parameter to the initializer.
I would like to do:
class MyDataController(BaseDataController): sql_class = MyModelClass ...
The following patch fixes it. If sql_class is passed to the initializer, it overrides the class's definition. If it's not defined in the class neither passed as a parameter, it raises ValueError? (as expected).
Just to avoid verbose code like:
mycontroller = MyDataController(sql_class = MyModelClass)