minor refactoring in grid(orderby)

This commit is contained in:
mdipierro committed 2015-05-06 08:56:56 -05:00
1 parent 6e2f9ad043
commit 6f91fdd833
2 files changed
+8 -11

No files matched your search

+7 -10
View File
@@ -2070,17 +2070,14 @@ class SQLFORM(FORM):
# is unique and usually indexed. See issue #679 # is unique and usually indexed. See issue #679
if not orderby: if not orderby:
orderby = field_id orderby = field_id
else: elif isinstance(orderby, list):
if isinstance(orderby, Expression): orderby = map(lambda a,b: a|b, orderby)
if orderby.first: elif isinstance(orderby, Field) and orderby is not field_id:
# here we're with a DESC order on a field # here we're with an ASC order on a field stored as orderby
# stored as orderby.first
if orderby.first is not field_id:
orderby = orderby | field_id orderby = orderby | field_id
else: elif (isinstance(orderby, Expression) and
# here we're with an ASC order on a field orderby.first and orderby.first is not field_id):
# stored as orderby # here we're with a DESC order on a field stored as orderby.first
if orderby is not field_id:
orderby = orderby | field_id orderby = orderby | field_id
return orderby return orderby