troubles with unicode

Petr Jakeš <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <CAERU-VYTQ0yg8CvOxBzoeeWq07n615LyDcYP08HgyuKsmX3ztA@mail.gmail.com>
I am lost,
trying to find solution whole night long.

all attempts to call the set method (see bellow) are finishing:

Page handler: <bound method ProdejniMista.ulozeniProdejnihoMista of
<fantomas.controllers.ProdejniMista instance at 0x2ac67a0>>
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 305, in ulozeniProdejnihoMista
    prodMisto.set(**slovnikArgumentu)
  File "/usr/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/main.py",
line 1120, 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
    for dbName, value in values]),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
33: ordinal not in range(128)


I have tried all possible combination to decode/encode the field values and
I am really sure all filelds are unicode fields when i am trying call the
set method.



automat.set(**slovnikArgumentu)


automat.set(telKontaktniOsoby =
slovnikArgumentu[telKontaktniOsoby].encode("utf-8"),
            najemZaRokBezDph =
slovnikArgumentu[najemZaRokBezDph].encode("utf-8"),
            kontaktniOsobaPrijmeni =
slovnikArgumentu[kontaktniOsobaPrijmeni].encode("utf-8"),
            nazevKontaktMistaPoruchy =
slovnikArgumentu[nazevKontaktMistaPoruchy].encode("utf-8"),
            psc = slovnikArgumentu[psc].encode("utf-8"),
            mesto = slovnikArgumentu[mesto].encode("utf-8"),
            adresa2 = slovnikArgumentu[adresa2].encode("utf-8"),
            adresa1 = slovnikArgumentu[adresa1].encode("utf-8"),
            zemDelka = slovnikArgumentu[zemDelka].encode("utf-8"),
            zemSirka = slovnikArgumentu[zemSirka].encode("utf-8"),
            elektrinaZaRokBezDph =
slovnikArgumentu[elektrinaZaRokBezDph].encode("utf-8"),
            cisloSignysPartnera =
slovnikArgumentu[cisloSignysPartnera].encode("utf-8"),
            pmid = slovnikArgumentu[pmid].encode("utf-8"),
            telReseniPoruchy =
slovnikArgumentu[telReseniPoruchy].encode("utf-8"),
            nazevProdejnihoMista =
slovnikArgumentu[nazevProdejnihoMista].encode("utf-8"),
            dnuRokOtevreno =
slovnikArgumentu[dnuRokOtevreno].encode("utf-8"),
            kontaktniOsobaJmeno =
slovnikArgumentu[kontaktniOsobaJmeno].encode("utf-8"))


My Environment:
Ubuntu Hardy Heron 64bit minimal server install

vs2521:/TG_web# yolk -l
Cheetah         - 2.4.4        - active
CherryPy        - 2.3.0        - active
DecoratorTools  - 1.8          - active
Extremes        - 1.1.1        - active
FormEncode      - 1.2.4        - active
Markdown        - 2.1.1        - active
PIL             - 1.1.6        - active
Paste           - 1.7.5.1      - active
PasteDeploy     - 1.5.0        - active
PasteScript     - 1.7.5        - active
PyProtocols     - 1.0a0dev-r2302 - active
Python          - 2.5.2        - active development
(/usr/lib/python2.5/lib-dynload)
RuleDispatch    - 0.5a1.dev-r2506 - active
SQLObject       - 0.10.1       - active
TurboCheetah    - 1.0          - active
TurboGears      - 1.0.10       - non-active
TurboGears      - 1.0.8        - active development
(/usr/local/lib/python2.5/site-packages/TurboGears-1.0.8-py2.5.egg)
TurboJson       - 1.1.4        - active
TurboKid        - 1.0.5        - active
configobj       - 4.7.2        - active
egenix-mx-base  - 3.2.2        - active
kid             - 0.9.6        - active
kinterbasdb     - 3.3.0        - active
pip             - 1.0.2        - active
pygooglechart   - 0.3.0        - active
setuptools      - 0.6c11       - non-active
setuptools      - 0.6c12dev-r88846 - active
setuptools      - 0.6c8        - non-active
simplejson      - 2.3.2        - active
wsgiref         - 0.1.2        - active development (/usr/lib/python2.5)
yolk            - 0.4.1        - active

Thanks for your hints

Petr

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2

_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.