Here is the traceback, when I'm not using to_utf8 suggested by Arthur. It happens when I do
            """project_name = to_utf8(project_name)"""
            projects = Project.select(
                AND(Project.q.userID == user.id,
                    Project.q.name == project_name))
            if projects.count():
                turbogears.flash("Project '%s' already exists!" % project_name)



2006-07-12 14:28:46,013 cherrypy.msg INFO HTTP: Page handler: <bound method Root.new_project of <ngtd.controllers.Root object at 0xb742f32c>>
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run
    self.main()
  File "/usr/lib/python2.4/site-packages/CherryPy- 2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in new_project
  File "/usr/lib/python2.4/site-packages/TurboGears- 0.9a6-py2.4.egg/turbogears/controllers.py", line 273, in expose
    output = database.run_with_transaction(
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/database.py", line 221, in run_with_transaction
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/controllers.py", line 290, in <lambda>
    mapping, fragment, *args, **kw)))
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/controllers.py", line 314, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/errorhandling.py", line 71, in try_call
    return func(self, *args, **kw)
  File "<string>", line 3, in new_project
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/identity/conditions.py", line 235, in require
    return fn(self, *args, **kwargs)
  File "/home/bms/Lab/ngtd/ngtd/controllers.py", line 88, in new_project
    if projects.count():
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1675-py2.4.egg/sqlobject/sresults.py", line 188, in count
    count = self.accumulate('COUNT(*)')
  File "/usr/lib/python2.4/site-packages/SQLObject- 0.7.1dev_r1675-py2.4.egg/sqlobject/sresults.py", line 172, in accumulate
    return conn.accumulateSelect(self, *expressions)
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1675-py2.4.egg/sqlobject/dbconnection.py ", line 381, in accumulateSelect
    val = self.queryOne(q)
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1675-py2.4.egg/sqlobject/dbconnection.py", line 348, in queryOne
    return self._runWithConnection(self._queryOne, s)
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1675-py2.4.egg/sqlobject/dbconnection.py", line 219, in _runWithConnection
    val = meth(conn, *args)
  File "/usr/lib/python2.4/site-packages/SQLObject- 0.7.1dev_r1675-py2.4.egg/sqlobject/dbconnection.py", line 341, in _queryOne
    self._executeRetry(conn, c, s)
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1675-py2.4.egg/sqlobject/mysql/mysqlconnection.py ", line 60, in _executeRetry
    return cursor.execute(query)
  File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 137, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 33, in defaulterrorhandler
    raise errorclass, errorvalue
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe3' in position 80: ordinal not in range(128)


On 7/12/06, Robin Haswell <[EMAIL PROTECTED]> wrote:

Bruno Silva wrote:
> I see it messed up in catwalk and a kid template page I made. If I take
> off the use_unicode=1 from the dburi, then I see it right in catwalk and
> in the template.
> But what I can't understand, is why in the controllers.py I do
>     p = Project(name=project_name, user=user)
> and it fires an UnicodeEncodeError
>
> and in the webconsole of the toolbox I can do this:
>>>> u = User.get (1)
>>>> p = Project(name="cão", user=u)
>
> with no problems.

I'm going to need a full traceback to answer that question. I need to
see what raised the exception.

-Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to