[Chicago] how to pass a dictionary to sqlobject

Lukasz Szybalski szybalski at gmail.com
Fri Aug 10 20:46:11 CEST 2007


Hello,
I have a problem when Im trying to save a form. My form when submitted
gives me a a dictionary with field names and values.

If my sqlobject class is

class App(SQLObject):
   idName = "App_Sid"
   class sqlmeta:
       fromDatabase = True
       table="App"


How do i pass my dictionary kwargs={'App_Sid':1,'First_name':'lucas'} ????

Doing something like this:
App(**kwargs)

Gives me an error like:

File "c:\python25\lib\site-packages\SQLObject-0.9.0-py2.5.egg\sqlobject\col.py",
line 596, in from_python
   (self.name, type(value), value), value, state)
Invalid: expected an int in the IntCol 'APPSID', got <type 'str'> '' instead


How do you guys pass a list of key and values to sqlobject?

Thanks,
Lucas


More information about the Chicago mailing list