瀏覽代碼

pygrass: Fix bug when the parameter in the order_by and group_by method is not unicode

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65531 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 9 年之前
父節點
當前提交
0055d0220e
共有 1 個文件被更改,包括 4 次插入8 次删除
  1. 4 8
      lib/python/pygrass/vector/table.py

+ 4 - 8
lib/python/pygrass/vector/table.py

@@ -99,15 +99,13 @@ class Filters(object):
         self._where = 'WHERE {condition}'.format(condition=condition)
         return self
 
-    def order_by(self, orderby):
+    def order_by(self, *orderby):
         """Create the order by condition
 
         :param orderby: the name of column/s to order the result
         :type orderby: str
         """
-        if not isinstance(orderby, unicode):
-            orderby = ', '.join(orderby)
-        self._orderby = 'ORDER BY {orderby}'.format(orderby=orderby)
+        self._orderby = 'ORDER BY {orderby}'.format(orderby=', '.join(orderby))
         return self
 
     def limit(self, number):
@@ -122,15 +120,13 @@ class Filters(object):
             self._limit = 'LIMIT {number}'.format(number=number)
         return self
 
-    def group_by(self, groupby):
+    def group_by(self, *groupby):
         """Create the group by condition
 
         :param groupby: the name of column/s to group the result
         :type groupby: str, list
         """
-        if not isinstance(groupby, unicode):
-            groupby = ', '.join(groupby)
-        self._groupby = 'GROUP BY {groupby}'.format(groupby=groupby)
+        self._groupby = 'GROUP BY {groupby}'.format(groupby=', '.join(groupby))
         return self
 
     def get_sql(self):