Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add a comment, reflow long lines

  • Loading branch information...
commit 22c445d7df6986e70465622bab81d9630e7dbe72 1 parent e0a4785
@mcdonc mcdonc authored
Showing with 18 additions and 7 deletions.
  1. +18 −7 substanced/sdi/views/folder.py
View
25 substanced/sdi/views/folder.py
@@ -388,7 +388,7 @@ def main(global_config, **settings):
config.scan()
XXX TODO Document ``sort_index``, ``reverse``, ``filter_text``.
- sort_index now also takes a string which lookes up the catalog index.
+ sort_index now also takes a string which looks up the catalog index.
"""
folder = self.context
request = self.request
@@ -413,16 +413,27 @@ def main(global_config, **settings):
text = catalog['text']
q = q & text.eq(filter_text)
- # sort_index can be a string with the name of the catalog index,
- # or, the index object itself. If it is a name, it is looked up.
- # XXX Untested!!! XXX TODO!!!
+ # BR: sort_index can be a string with the name of the catalog index,
+ # or, the index object itself. If it is a name, it is looked up. XXX
+ # Untested!!! XXX TODO!!!
+ #
+ # CM: this should be a tuple of (catalog_name, index_name) at least,
+ # and optionally a callback that accepts the folder, and which returns
+ # the index object. This logic should not be done here; it should
+ # be done in views that call this method instead.
+
if isinstance(sort_index, basestring):
try:
sort_index = catalog[sort_index]
except KeyError:
- raise KeyError(('Index %r is missing from the catalog. ' +
- 'If sort_index is a string, then it must match the name of a catalog index. %r')
- % (sort_index, tuple(catalog.keys())))
+ keys = tuple(catalog.keys())
+ raise KeyError(
+ (
+ 'Index %r is missing from the catalog. '
+ 'If sort_index is a string, then it must match the '
+ 'name of a catalog index. %r' % (sort_index, keys)
+ )
+ )
if folder.is_ordered() and sort_index is None:
# hypatia resultset.sort will call IFolder.sort method
Please sign in to comment.
Something went wrong with that request. Please try again.