Message3398
Currently if sorting by a Link property with no 'order'
property defined, different backends behave differently:
- SQL backends sort by 'id'
- Metakit sorts by labelprop
- anydbm sorts by getkey()
The attached patch introduces a new function orderprop
into hyperdb.Class and a setorderprop method to set the
ordering property. It patches all the backends to use
the new property.
The new sort-property resolution order is as follows:
- If an order property was defined using setorderprop,
this property is used
- If a property named 'order' is defined it is used
- labelprop is used
This unifies behaviour across backends. For people
*really* wanting to sort by id, they can get the old
SQL backend behaviour using setorderprop ('id').
The patch may be off by some lines, I've used my
previous patch introducing setlabelprop as the base. If
needed I can resubmit the patch against a given source.
Note that the "filter" method of Class uses a lot of
redundant code for mysql and the other sql-based
backends. I have not dared to refactor this without a
regression test in place (and a mysql installation to
run the test).
The patch is only tested with the postgres backend.
I'm unsure about the anydbm backend: If 'id' is
returned by orderprop(), I set the sortkey to None --
simulating the old behaviour. I'm not sure if the id
attribute behaves as all other attributes for sorting
(or if it is naturally sorted by key anyway).
-- Ralf |
|
Date |
User |
Action |
Args |
2009-02-03 14:24:01 | admin | link | issue1379534 messages |
2009-02-03 14:24:01 | admin | create | |
|