Edgewall Software

Opened 10 years ago

Last modified 9 years ago

#11701 closed enhancement

Abstract base class for Model classes — at Version 6

Reported by: Ryan J Ollos Owned by:
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords: model
Cc: leho@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

An abstract base class for model classes is proposed for discussion. This was previously mentioned in #11609 and #11648. At a minimum we can discuss the challenges in making the API consistent for Model classes and perhaps improve some minor issues, even if we don't end up implementing an abstract base class.

Change History (6)

comment:1 by Ryan J Ollos, 10 years ago

I created this ticket because I wanted to look at this ahead of changes to Component and Version models in #1233.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Ryan J Ollos, 10 years ago

One API inconsistency we may want to fix is the return value from select class methods. In most cases a generator is returned, but there are cases of a list being returned:

I suppose the difference is that the two method with return sort the list, but it seem ideal to always return a generator for consistency.

comment:3 by Ryan J Ollos, 10 years ago

The Bloodhound ModelBase class (mentioned in comment:1:ticket:11609, [bh:browser:/trunk/bloodhound_dashboard/bhdashboard/model.py@1570461:44#L44]), has some useful aspects that we may want to adopt. For example, one obstacle to having a common signature for the select method for all the model classes is the include_completed parameter of Milestone class (though there are many other obstacles as well, and going too far down this path might just lead to the changes suggested by GenericTrac). The include_completed and similar parameters would be handled more generally by ModelBase with where, limit and order_by parameters: [bh:browser:/trunk/bloodhound_dashboard/bhdashboard/model.py?rev=1570461&marks=250#L249].

comment:4 by lkraav <leho@…>, 10 years ago

Cc: leho@… added

comment:5 by Ryan J Ollos, 9 years ago

Owner: Ryan J Ollos removed

comment:6 by Ryan J Ollos, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.