Thanks Jim, I just fixed it in trunk and posting 1.90.6. Thanks for reporting the issue.
Massimo On Dec 20, 11:02 am, iiijjjiii <[email protected]> wrote: > I get an error if I try to copy a row that has a date field. > > >>> import copy > >>> db.define_table('test_table', db.Field('test_field', 'date'), > >>> migrate=True) > >>> db.test_table.insert(test_field='2010-12-20') > 1 > >>> row = db(db.test_table.id==1).select()[0] > >>> row_copy = copy.copy(row) > > Traceback (most recent call last): > File "<console>", line 1, in <module> > File "/usr/lib/python2.7/copy.py", line 84, in copy > rv = reductor(x) > File "/srv/http/igeejo/web2py/gluon/dal.py", line 3106, in > Row_pickler > return Row_unpickler, (marshal.dumps(data.as_dict()),) > ValueError: unmarshallable object > > The data field looks like this: > > data: <Row {'update_record': <function <lambda> at 0x90501ec>, > 'adate': datetime.date(2010, 12, 20), 'id': 1L, 'delete_record': > <function <lambda> at 0x9109c34>}> > > The marshal.dumps method doesn't appear to handle datetime instances. > > >>> import marshal > >>> import datetime > >>> marshal.dumps({'field': datetime.date(2010,12,20)}) > > Traceback (most recent call last): > File "<console>", line 1, in <module> > ValueError: unmarshallable object > > Other field types, for example, datetime.datetime and decimal.Decimal, > will cause the same problem. > > This worked in version 1.89.5. Is there another recommended way to > copy a row? > > Jim Karsten

