I needed to customize the behavior of gluon.contrib.populate.populate(), so I created by version by adding ``values=None`` argument, and this code after the ``elif field.type == 'id': continue``:
elif values is not None and values.has_key(fieldname):
if callable(values[fieldname]):
record[fieldname] = values[fieldname](table, fieldname)
else:
record[fieldname] = values[fieldname]
Brief explanation: for each field a values[fieldname] is checked. If it
is callable, the return value of values[fieldname](table, fieldname) is
used for the field. Else, directly values[fieldname] is used as field
value.
BTW: Wouldn't be better to move IUP outside that module, maybe in a
pickled shelf file or so? Or, at least, split the dict on multiple lines
to avoid having a single line of that length.
I don't know which editor are you using, but eclipse takes some minutes
to open the file and once opened it becomes unusable; with gedit it's a
bit better but still very hard to navigate, due to the too long single
line.. [on a Core i7 M620 @2.67 GHz 8Gb RAM machine..]
--
Samuele ~redShadow~ Santi
----------------------------------------------------------------
redshadow[at]hackzine.org - redshadowhack[at]gmail.com
Blog: http://hackzine.org
GPG Key signature:
050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933
----------------------------------------------------------------
/me recommends:
Squadra Informatica - http://www.squadrainformatica.com
----------------------------------------------------------------
- Proud ThinkPad T-Series owner
- Registered Linux-User: #440008
* GENTOO User since 1199142000 (2008-01-01)
* former DEBIAN SID user
----------------------------------------------------------------
"Software is like sex: it's better when it's free!"
-- Linus Torvalds
signature.asc
Description: This is a digitally signed message part

