diff --git a/VERSION b/VERSION index 3ece8237..0bbdce60 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-08-26 09:32:05) dev +Version 2.00.0 (2012-08-26 10:41:21) dev diff --git a/gluon/dal.py b/gluon/dal.py index 0e3c5d1e..309c6e0b 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -6288,6 +6288,8 @@ class Row(object): a dictionary that lets you do d['a'] as well as d.a this is only used to store a Row """ + def __init__(self,*args,**kwargs): + self.__dict__.update(*args,**kwargs) def __getitem__(self, key): key=str(key) @@ -6320,13 +6322,16 @@ class Row(object): def values(self): return self.__dict__.values() + + def __iter__(self): + return self.__dict__.__iter__() def __str__(self): ### this could be made smarter - return '' % dict.__repr__(self) + return '' % self.__dict__ def __repr__(self): - return '' % dict.__repr__(self) + return '' % self.__dict__ def __int__(self): return dict.__getitem__(self,'id') @@ -6367,7 +6372,6 @@ class Row(object): del d[k] return d - def Row_unpickler(data): return Row(cPickle.loads(data)) @@ -8903,10 +8907,11 @@ class Rows(object): """ serializes the table using sqlhtml.SQLTABLE (if present) """ + alphanumeric = re.compile('[a-zA-Z]\w*') if strict: ncols = len(self.colnames) def f(row,field,indent=' '): - if isinstance(row,dict): + if isinstance(row,Row): spc = indent+' \n' items = [f(row[x],x,indent+' ') for x in row] return '%s<%s>\n%s\n%s' % ( @@ -8916,7 +8921,12 @@ class Rows(object): indent, field) elif not callable(row): - return '%s<%s>%s' % (indent,field,row,field) + if alphanumeric.match(field): + return '%s<%s>%s' % \ + (indent,field,row,field) + else: + return '%s%s' % \ + (indent,field,row) else: return None return '<%s>\n%s\n' % (