Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #309 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

[PATCH] sql_class from BaseDataController can't be overriden via inheritance

Reported by: alberto@… Owned by: anonymous
Priority: normal Milestone: 0.9
Component: CherryPy Version:
Severity: normal Keywords: BaseDataController


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)


datacontroller.patch Download (957 bytes) - added by alberto@… 13 years ago.

Change History

Changed 13 years ago by alberto@…

comment:1 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed

committed in [432].

Note: See TracTickets for help on using tickets.