Edgewall Software

Changes between Version 1 and Version 2 of TracDev/ScratchPad/DataModels


Ignore:
Timestamp:
Jul 30, 2015, 2:21:42 AM (7 years ago)
Author:
Ryan J Ollos
Comment:

Document comments from #11701.

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/ScratchPad/DataModels

    v1 v2  
    1212
    1313We should standardize on `NULL` again. When retrieving `NULL` values from the database, we get `None` in Python. If needed, we can carry on this distinct meaning yet manipulate it as a string by converting `None` to the special value [apidoc:api/trac_util_text#trac.util.text.empty empty]. See e.g. what we do for  [source:trunk/trac/ticket/model.py@11111:127,137#L110 ticket fields].
     14
     15=== Class methods
     16
     17Class methods, one example being `select`, are used for table-wide queries.
     18
     19The signature of the `select` method is not consistent across all classes.
     20The `Milestone` class has an [browser:/trunk/trac/ticket/model.py?rev=13060&marks=1129#L1121 include_completed] parameter in the `select` method.
     21We could reconcile the inconsistency by having `where`, `limit` and `order_by` parameters on each method, with the parameters directly mapping to phrases in the SQL query.
     22This would make the methods more generally useful to plugin developers.
     23
     24Not only is the interface inconsistent, but also the return value. In most cases a generator is returned by `select`, however some `select` methods return a list:
     25* [browser:trunk/trac/ticket/model.py@13060:1137#L1128​]
     26* [browser:trunk/trac/ticket/model.py@13060:1234#L1222​]