I've got a form where the field names match my DB columns. It looks
like I should be able to dump this into the db.insert values and have
it work, but I keep getting an error from the submit button in
web.input. I have been able to solve the problem as follows:
...
db = web.database(dbn='sqlite', db='testdatabase.db')
...
def POST(self):
my_dict = web.input()
del my_dict['submit']
db.insert('table', _test=False, **my_dict)
...
I have three questions:
1) Is this del of the submit key from my_dict the best way to solve
the database column miss-match problem?
2) The API docs only show passing a dictionary, instead of keyword
value pairs, for multi insert, not insert. In that context it looks
like the dictionary is passed into multiple_insert as values=my_dict
not **my_dict. I was unable to make values=my_dict work. Am I doing
something wrong by using the ** operator?
3) How can I sanitize user input? I cannot find anything in the docs
about it.
Thanks for the help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---