From: Petr J. <pet...@tp...> - 2012-01-30 00:20:24
|
> > ============= set method start =============== > > <type 'str'> telKontaktniOsoby <type 'unicode'> +420734803579 > > <type 'str'> kontaktniOsobaPrijmeni <type 'unicode'> Zburn??k > > <type 'str'> nazevKontaktMistaPoruchy <type 'unicode'> recepce > > > > ============ _SO_update start ===================== > > <type 'unicode'> tel_kontaktni_osoby <type 'unicode'> +420734803579 > > <type 'unicode'> kontaktni_osoba_prijmeni <type 'unicode'> Zburn??k > > <type 'unicode'> nazev_kontakt_mista_poruchy <type 'unicode'> recepce > > You made all columns StringCol where I've advised you to make them > all UnicodeCol. > > Hmmm.... I am completely lost :( I am testing the unicode type and replacing it with the utf-8 encoded string before I am calling the .set() method: for key, value in argumentsDict.items(): print type(key), key, type(value), value if isinstance(value, unicode): argumentsDict[key] = value.encode("utf-8") It is throwing UnicodeDecodeError anyway.... Grrrr ============= set method start =============== <type 'str'> telKontaktniOsoby value: <type 'str'> value repr: '+420721870631' <type 'str'> kontaktniOsobaPrijmeni value: <type 'str'> value repr: 'Kra\xc4\x8dmar' <type 'str'> nazevKontaktMistaPoruchy value: <type 'str'> value repr: 'Vr\xc3\xa1tnice' <type 'str'> psc value: <type 'str'> value repr: '46117' <type 'str'> mesto value: <type 'str'> value repr: 'Liberec' <type 'str'> geocodeAccuracy value: <type 'str'> value repr: 'Z' <type 'str'> adresa2 value: <type 'str'> value repr: '' <type 'str'> adresa1 value: <type 'str'> value repr: '17.listopadu 587/12' <type 'str'> zemDelka value: <type 'str'> value repr: '15.089062' <type 'str'> zemSirka value: <type 'str'> value repr: '50.770344' <type 'str'> elektrinaZaRokBezDph value: <type 'str'> value repr: '2052' <type 'str'> kontaktniOsobaJmeno value: <type 'str'> value repr: 'Zden\xc4\x9bk' <type 'str'> cisloSignysPartnera value: <type 'str'> value repr: '8' <type 'str'> telReseniPoruchy value: <type 'str'> value repr: '+420485355217' <type 'str'> nazevProdejnihoMista value: <type 'str'> value repr: 'Kolej LBC E' <type 'str'> dnuRokOtevreno value: <type 'str'> value repr: '340' <type 'str'> najemZaRokBezDph value: <type 'str'> value repr: '6000' ============ _SO_update start ===================== <type 'unicode'> tel_kontaktni_osoby value: <type 'str'> value repr: '+420721870631' <type 'unicode'> kontaktni_osoba_prijmeni value: <type 'str'> value repr: 'Kra\xc4\x8dmar' <type 'unicode'> nazev_kontakt_mista_poruchy value: <type 'str'> value repr: 'Vr\xc3\xa1tnice' <type 'unicode'> psc value: <type 'str'> value repr: '46117' <type 'unicode'> mesto value: <type 'str'> value repr: 'Liberec' <type 'unicode'> geocode_accuracy value: <type 'str'> value repr: 'Z' <type 'unicode'> adresa2 value: <type 'str'> value repr: '' <type 'unicode'> adresa1 value: <type 'str'> value repr: '17.listopadu 587/12' <type 'unicode'> zem_delka value: <type 'str'> value repr: '15.089062' <type 'unicode'> zem_sirka value: <type 'str'> value repr: '50.770344' <type 'unicode'> elektrina_za_rok_bez_dph value: <type 'str'> value repr: '2052' <type 'unicode'> kontaktni_osoba_jmeno value: <type 'str'> value repr: 'Zden\xc4\x9bk' <type 'unicode'> cislo_signys_partnera value: <type 'str'> value repr: '8' <type 'unicode'> tel_reseni_poruchy value: <type 'str'> value repr: '+420485355217' <type 'unicode'> nazev_prodejniho_mista value: <type 'str'> value repr: 'Kolej LBC E' <type 'unicode'> dnu_rok_otevreno value: <type 'str'> value repr: '340' <type 'unicode'> najem_za_rok_bez_dph value: <type 'str'> value repr: '6000' 2012-01-30 01:13:08,807 cherrypy.msg INFO HTTP: Page handler: <bound method ProdejniMista.ulozeniProdejnihoMista of <fantomas.controllers.ProdejniMista instance at 0x23fd638>> Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line 121, in _run self.main() File "/usr/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line 264, in main body = page_handler(*virtual_path, **self.params) File "<string>", line 3, in ulozeniProdejnihoMista File "/usr/local/lib/python2.5/site-packages/TurboGears-1.0.8-py2.5.egg/turbogears/controllers.py", line 360, in expose *args, **kw) File "<string>", line 5, in run_with_transaction File "/usr/local/lib/python2.5/site-packages/TurboGears-1.0.8-py2.5.egg/turbogears/database.py", line 359, in so_rwt retval = func(*args, **kw) File "<string>", line 5, in _expose File "/usr/local/lib/python2.5/site-packages/TurboGears-1.0.8-py2.5.egg/turbogears/controllers.py", line 373, in <lambda> mapping, fragment, args, kw))) File "/usr/local/lib/python2.5/site-packages/TurboGears-1.0.8-py2.5.egg/turbogears/controllers.py", line 410, in _execute_func output = errorhandling.try_call(func, *args, **kw) File "/usr/local/lib/python2.5/site-packages/TurboGears-1.0.8-py2.5.egg/turbogears/errorhandling.py", line 77, in try_call return func(self, *args, **kw) File "/TG_web/fantomas/controllers.py", line 317, in ulozeniProdejnihoMista prodMisto.set(**slovnikArgumentu) File "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/main.py", line 1123, in set self._connection._SO_update(self, args) File "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py", line 509, in _SO_update myQuery = "UPDATE %s SET %s WHERE %s = (%s)" % (so.sqlmeta.table, ", ".join(["%s = (%s)" % (dbName, self.sqlrepr(value)) for dbName, value in values]), so.sqlmeta.idName, self.sqlrepr(so.id)) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 4: ordinal not in range(128) Petr |