From dce8dbff4fd5a357c5b5ee7e14b51cf11c0e074e Mon Sep 17 00:00:00 2001 From: Massimo DiPierro Date: Mon, 12 Mar 2012 15:15:31 -0500 Subject: [PATCH] issue 701, select(...,processor=f) --- VERSION | 2 +- gluon/dal.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 62930809..6712cef3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.7 (2012-03-12 13:48:35) dev +Version 1.99.7 (2012-03-12 15:15:29) dev diff --git a/gluon/dal.py b/gluon/dal.py index a9e45f07..bcf07941 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -1317,7 +1317,8 @@ class BaseAdapter(ConnectionPool): rows = list(rows) limitby = attributes.get('limitby', None) or (0,) rows = self.rowslice(rows,limitby[0],None) - return self.parse(rows,fields,self._colnames) + processor = attributes.get('processor',self.parse) + return processor(rows,fields,self._colnames) def _count(self, query, distinct=None): tablenames = self.tables(query) @@ -3758,7 +3759,8 @@ class GoogleDatastoreAdapter(NoSQLAdapter): item.key().name()) or getattr(item, t) for t in fields] for item in items] colnames = ['%s.%s' % (tablename, t) for t in fields] - return self.parse(rows, fields, colnames, False) + processor = attributes.get('processor',self.parse) + return processor(rows,fields,colnames,False) def count(self,query,distinct=None): @@ -3952,7 +3954,8 @@ class CouchDBAdapter(NoSQLAdapter): tablename = colnames[0].split('.')[0] ctable = self.connection[tablename] rows = [cols['value'] for cols in ctable.query(fn)] - return self.parse(rows, fields, colnames, False) + processor = attributes.get('processor',self.parse) + return processor(rows,fields,colnames,False) def delete(self,tablename,query): if not isinstance(query,Query): @@ -4289,7 +4292,8 @@ class MongoDBAdapter(NoSQLAdapter): rows.append(row) #else the id is not supposed to be included. Work around error. mongo always sends key:( - return self.parse(rows,fields,mongofields_dict.keys(),False) + processor = attributes.get('processor',self.parse) + return processor(rows,fields,mongofields_dict.keys(),False) def INVERT(self,first): #print "in invert first=%s" % first @@ -5242,8 +5246,8 @@ class IMAPAdapter(NoSQLAdapter): tablename, imapqry_array , fieldnames = self._select(query,fields,attributes) # parse result and return a rows object colnames = fieldnames - result = self.parse(imapqry_array, fields, colnames) - return result + processor = attributes.get('processor',self.parse) + return processor(imapqry_array, fields, colnames) def update(self, tablename, query, fields): # print "_update"