can you print data? What is in data?
On Nov 9, 12:20 pm, Omri <[email protected]> wrote: > I did some tryouts and it seems that the only problem is with the > update method, and then only when called through service.jsonrpc. I > created the following model: > > db.define_table("debug_stuff", > Field("name", length=100), > Field("textfield", "text"), > format="%(name)s") > > and defined the following function in the controller (default): > > @service.jsonrpc > def debug_umlauts(data): > # db["debug_stuff"].insert(**data) # <--- Worked, no problem > # db(db["debug_stuff"]["id"] == 2).update(**data) # <--- Didn't > work > db(db["debug_stuff"]["id"] == 2).update(name = data['name'], > textfield=data['textfield']) # <--- Worked > return "OK update" > > The only line that didn't work was the second one, where I tried to > use the **data for the update method. The problem is that I want the > method to be general, and therefore cannot use the method of the third > line to specify for .update what fields I'm updating. > > Thanks, > Omri > > On Nov 8, 5:19 pm, mdipierro <[email protected]> wrote: > > > Can you try put a u in front of the string u"..." > > > On Nov 8, 5:30 am, Omri <[email protected]> wrote: > > > > Hello, > > > > I'm having a unicode problem with the DAL. > > > > I'm developing a (mainly) RPC database application with qooxdoo as JS > > > framework and web2py as the webserver. > > > > I have created a fairly generic update_record function which simply > > > gets two input variables - a table name and a data dictionary with > > > name/value pairs which correspond to the fields of the table. > > > My function looks like this: > > > > def update_record(table_name, data): > > > db(db[table_name]['id'] == data['id']).update(**data) > > > return db(db[table_name]['id'] == data['id']).select() > > > > My application should work both in English and in German, and my > > > problem is that when I try to update a string value with an Umlaut > > > (example - "Überwlad") I get an error: > > > "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in > > > position..." > > > > I am able to insert records to the database with Umlauts, but I use a > > > different method for the insert. I use the syntax of .insert(name = > > > value, name2 = value2,...). > > > > I tried to encode all the data keys which are unicode objects without > > > success, it keeps raising the same error. > > > > Am I missing something here, or is this a bug? And more interestingly, > > > how can it be solved? > > > > Thanks, > > > Omri > >

