populate list:reference, issue 917, thanks Simonm3

This commit is contained in:
mdipierro
2012-08-05 21:19:57 -05:00
parent 4f41b672e8
commit e99b4e5aa3
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.0 (2012-08-05 19:52:16) dev
Version 2.00.0 (2012-08-05 21:19:55) dev
+1 -1
View File
@@ -140,7 +140,7 @@ def populate(table, n, default=True, compute=False):
ids[tablename] = [x.id for x in table._db(table._db[field.type[15:]].id>0).select()]
n = len(ids[tablename])
if n:
record[fieldname] = [item[0] for item in random.sample(ids[tablename], random.randint(0,n-1)/2)]
record[fieldname] = [item for item in random.sample(ids[tablename], random.randint(0,n-1)/2)]
else:
record[fieldname] = 0
elif field.type=='list:string' and hasattr(field.requires,'options'):