Mercurial > p > roundup > code
comparison doc/design.txt @ 3682:193f316dbbe9
More transitive-property support.
- Implemented transitive properties in sort and group specs. Sort/group
specs can now be lists of specs.
- All regression tests except for one metakit backend test related to
metakit having no representation of NULL pass
- Fixed more PEP 8 whitespace peeves (and probably introduced some new
ones :-)
- Moved Proptree from support.py to hyperdb.py due to circular import
- Moved some proptree-specific methods from Class to Proptree
- Added a test for sorting by ids -> should be numeric sort (which now
really works for all backends)
- Added "required" attribute to all property classes in hyperdb (e.g.,
String, Link,...), see Feature Requests [SF#539081]
-> factored common stuff to _Type. Note that I also converted to a
new-style class when I was at it. Bad: The repr changes for new-style
classes which made some SQL backends break (!) because the repr of
Multilink is used in the schema storage. Fixed the repr to be
independent of the class type.
- Added get_required_props to Class. Todo: should also automagically
make the key property required...
- Add a sort_repr method to property classes. This defines the
sort-order. Individual backends may use diffent routines if the
outcome is the same. This one has a special case for id properties to
make the sorting numeric. Using these methods isn't mandatory in
backends as long as the sort-order is correct.
- Multilink sorting takes orderprop into account. It used to sort by
ids. You can restore the old behaviour by specifying id as the
orderprop of the Multilink if you really need that.
- If somebody specified a Link or Multilink as orderprop, we sort by
labelprop of that class -- not transitively by orderprop. I've
resited the tempation to implement recursive orderprop here: There
could even be loops if several classes specify a Link or Multilink as
the orderprop...
- Fixed a bug in Metakit-Backend: When sorting by Links, the backend
would do a natural join to the Link class. It would rename the "id"
attribute before joining but *not* all the other attributes of the
joined class. So in one test-case we had a name-clash with
priority.name and status.name when sorting *and* grouping by these
attributes. Depending on the order of joining this would produce a
name-clash with broken sort-results (and broken display if the
original class has an attribute that clashes). I'm now doing the
sorting of Links in the generic filter method for the metakit backend.
I've left the dead code in the metakit-backend since correctly
implementing this in the backend will probably be more efficient.
- updated doc/design.html with the new docstring of filter.
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Mon, 21 Aug 2006 12:19:48 +0000 |
| parents | 8ee9b38789af |
| children | 790363e96852 |
comparison
equal
deleted
inserted
replaced
| 3681:b9301ae1c34d | 3682:193f316dbbe9 |
|---|---|
| 469 db.issue.find(messages='1') | 469 db.issue.find(messages='1') |
| 470 db.issue.find(messages={'1':1,'3':1}, files={'7':1}) | 470 db.issue.find(messages={'1':1,'3':1}, files={'7':1}) |
| 471 """ | 471 """ |
| 472 | 472 |
| 473 def filter(self, search_matches, filterspec, sort, group): | 473 def filter(self, search_matches, filterspec, sort, group): |
| 474 """ Return a list of the ids of the active items in this | 474 """Return a list of the ids of the active nodes in this class that |
| 475 class that match the 'filter' spec, sorted by the group spec | 475 match the 'filter' spec, sorted by the group spec and then the |
| 476 and then the sort spec. | 476 sort spec. |
| 477 | |
| 478 "filterspec" is {propname: value(s)} | |
| 479 | |
| 480 "sort" and "group" are [(dir, prop), ...] where dir is '+', '-' | |
| 481 or None and prop is a prop name or None. Note that for | |
| 482 backward-compatibility reasons a single (dir, prop) tuple is | |
| 483 also allowed. | |
| 484 | |
| 485 "search_matches" is {nodeid: marker} | |
| 486 | |
| 487 The filter must match all properties specificed. If the property | |
| 488 value to match is a list: | |
| 489 | |
| 490 1. String properties must match all elements in the list, and | |
| 491 2. Other properties must match any of the elements in the list. | |
| 492 | |
| 493 Note that now the propname in filterspec and prop in a | |
| 494 sort/group spec may be transitive, i.e., it may contain | |
| 495 properties of the form link.link.link.name, e.g. you can search | |
| 496 for all issues where a message was added by a certain user in | |
| 497 the last week with a filterspec of | |
| 498 {'messages.author' : '42', 'messages.creation' : '.-1w;'} | |
| 477 """ | 499 """ |
| 478 | 500 |
| 479 def list(self): | 501 def list(self): |
| 480 """Return a list of the ids of the active items in this | 502 """Return a list of the ids of the active items in this |
| 481 class. | 503 class. |
