Commits

Olemis Lang  committed 9e38f31

GViz QL : Ensure only tuples in 'order by' clause since 'handle_orderseq' is not invoked. All tests ... [ok]

  • Participants
  • Parent commits ebc2f81
  • Branches gviz_ql

Comments (0)

Files changed (2)

File trac-dev/gviz/tracgviz/gvizql.py

       seq = Sequence([seq])
     elif isinstance(seq, dict):
       seq = Sequence([(seq, True)])
-    self.order_def = seq
+    self.order_def = [c if isinstance(c, tuple) else (c, True) for c in seq]
     self.sort = [(self._resolve_schema(c, lambda colnm: (colnm, None))[0], is_asc) 
         for c, is_asc in self.order_def ]
 
 
   handle_orderasc = handle_orderdsc = _handle_explicit_order
 
+  # FIXME: This method never gets called
   def handle_orderseq(self, orderdef, _, neworder):
     orderdef = orderdef[1]
     neworder = neworder[1]
       neworder = (neworder, True)
     if isinstance(orderdef, self.Sequence):
       orderdef.append(neworder)
+      logging.debug('Appending sort expressions %s | %s', orderdef, neworder)
     else:
       if not isinstance(orderdef, tuple):
         # Default order = asc
         orderdef = (orderdef, True)
+      logging.debug('Merging sort expressions %s | %s', orderdef, neworder)
       orderdef = self.Sequence([orderdef, neworder])
     return orderdef
 

File trac-dev/gviz/tracgviz/testing/test_gvizql.py

       *****
       * Parsing
       *****
-      NotSupported  :(
+      [(u'dept', True), (u'salary', False)]
+      *****
+      * Result
+      *****
+      GVizUnsupportedQueryOp  :  Unable to evaluate ORDER BY clause. Either the whole clause or an specific feature is not supported yet.
+
 
       >>> parse("  select dept , lunchTime   group by dept "
       ...       "   order by dept", 'sort', 'aggregate', 'cols')