[zope2-tracker] [Bug 143682] Re: ZCatalog query with DateIndex sort_on removes results

Tres Seaver tseaver at palladion.com
Mon Apr 12 13:30:46 EDT 2010


The referenced thread points up the fact that sorting objects missing the sort attribute isn't possible without imposing some kind of policy.  Third-party indexes such as Dieters are free to do so, but the core Zope indexes will not.
The application writer can work around this issue by indexing a method / script which spells out the policy.  E.g.,
add a PythonScript, sortableDate, to your Zope root, and then index it, rather than the 'modified' method:

  ## Script (Python) "sortableDate"
  mod = getattr(context, 'modified', None)
  if mod is not None:
      return Mode
  # policy: sort no-value items as earlier
  return context.ZopeTime('1900-01-01')

** Changed in: zope2
       Status: New => Invalid

-- 
ZCatalog query with DateIndex sort_on removes results
https://bugs.launchpad.net/bugs/143682
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.


More information about the zope2-tracker mailing list