[GRASS-SVN] r65531 - grass/trunk/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 1 23:29:47 PDT 2015


Author: zarch
Date: 2015-07-01 23:29:47 -0700 (Wed, 01 Jul 2015)
New Revision: 65531

Modified:
   grass/trunk/lib/python/pygrass/vector/table.py
Log:
pygrass: Fix bug when the parameter in the order_by and group_by method is not unicode

Modified: grass/trunk/lib/python/pygrass/vector/table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/table.py	2015-07-01 22:03:53 UTC (rev 65530)
+++ grass/trunk/lib/python/pygrass/vector/table.py	2015-07-02 06:29:47 UTC (rev 65531)
@@ -99,15 +99,13 @@
         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 @@
             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):



More information about the grass-commit mailing list