What steps will reproduce the problem? 1. define a table with a field of type "date"
auto-populate that table
open the table in appadmin running under dev_appserver What is the expected output? What do you see instead? I expected to see a list of the inserted rows. Instead, I see a page with zero selected rows.
Looking at the console, I can see that an error is being triggered in db_wizard_populate.py:
"error populating table t_mytable: Property f_mydate must be a date, not a datetime"
Looking at the code for populate.py, it's clear that there is a bug on line 79, where fields of type date and datetime are being both assigned instances of datetime.datetime, when a date is expecting an instance of datetime.date. There should be a separate "elif" clause for each type, like this:
elif field.type == 'datetime':
record[fieldname] = \
datetime.datetime(2009,1,1) - \
datetime.timedelta(days=random.randint(0,365))
elif field.type == 'date':
record[fieldname] = \
datetime.date(2009,1,1) - \
datetime.timedelta(days=random.randint(0,365)) What version of the product are you using? On what operating system? I'm running changeset 2ad3a4dfc902 on OS X 10.6.5 Please provide any additional information below.
From tiago.he...@gmail.com on November 30, 2010 14:51:01
What steps will reproduce the problem? 1. define a table with a field of type "date"
Looking at the console, I can see that an error is being triggered in db_wizard_populate.py:
"error populating table t_mytable: Property f_mydate must be a date, not a datetime"
Looking at the code for populate.py, it's clear that there is a bug on line 79, where fields of type date and datetime are being both assigned instances of datetime.datetime, when a date is expecting an instance of datetime.date. There should be a separate "elif" clause for each type, like this:
Original issue: http://code.google.com/p/web2py/issues/detail?id=132