From d295a479c6ffa700886f4dac0146a8659d9ffdfc Mon Sep 17 00:00:00 2001 From: mdipierro Date: Tue, 24 Jul 2012 21:11:35 -0500 Subject: [PATCH] crud.select(fields=[..]), fields can now be string, issue 901 --- VERSION | 2 +- gluon/sqlhtml.py | 3 ++- gluon/tools.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 07f9e596..d490530f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-07-24 06:53:03) dev +Version 2.00.0 (2012-07-24 21:11:30) dev diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 0c7cae23..bef67d18 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -1241,7 +1241,8 @@ class SQLFORM(FORM): ### do not know why this happens, it should not (source_file, original_filename) = \ (cStringIO.StringIO(f), 'file.txt') - newfilename = field.store(source_file, original_filename, field.uploadfolder) + newfilename = field.store(source_file, original_filename, + field.uploadfolder) # this line is for backward compatibility only self.vars['%s_newfilename' % fieldname] = newfilename fields[fieldname] = newfilename diff --git a/gluon/tools.py b/gluon/tools.py index 923194b1..48943cb4 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -3397,6 +3397,8 @@ class Crud(object): query = table.id > 0 if not fields: fields = [field for field in table if field.readable] + else: + fields = [table[f] if isinstance(f,str) else f for f in fields] rows = self.db(query).select(*fields,**dict(orderby=orderby, limitby=limitby)) return rows