Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #998 (closed defect: worksforme)

Opened 11 years ago

Last modified 8 years ago

CatWalk exception when browsing objects with Unicode name

Reported by: vfigueiro Owned by: chrisz
Priority: normal Milestone: 1.0.x bugfix
Component: Toolbox.Catwalk Version: 1.0b1
Severity: normal Keywords: needs confirmation, catwalk, unicode,
Cc:

Description (last modified by Chris Arndt) (diff)

When I select the browse view in CatWalk and the selected SO has non-ascii titles, I get the following output:

2006-06-22 21:14:42,409 cherrypy.msg INFO HTTP: Page handler: <bound method Browse.index of <turbogears.toolbox.catwalk.browse.Browse object at 0x40b2e72c>>
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 index
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/controllers.py", line 280, in expose
    output = database.run_with_transaction(
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/database.py", line 221, in run_with_transaction
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/controllers.py", line 297, in <lambda>
    mapping, fragment, *args, **kw)))
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/controllers.py", line 321, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/errorhandling.py", line 68, in try_call
    return func(self, *args, **kw)
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/toolbox/catwalk/browse.py", line 24, in index
    total,rows = self.rows_for_model(object_name,start,page_size,filters)
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/toolbox/catwalk/browse.py", line 126, in rows_for_model
    rows = self.foreign_key_alias_value(object_name,rows)
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/toolbox/catwalk/browse.py", line 180, in foreign_key_alias_value
    fk_values = self.foreign_key_query(column,alias,[x[column_name] for x in rows])
  File "/home/vfigueiro/dev/tg/turbogears/turbogears/toolbox/catwalk/browse.py", line 191, in foreign_key_query
    for id,alias in conn.queryAll(query): fk_values[str(id)] = self.encode_label( alias )
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1824-py2.4.egg/sqlobject/dbconnection.py", line 755, in queryAll
    return self._dbConnection._queryAll(self._connection, s)
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1824-py2.4.egg/sqlobject/dbconnection.py", line 312, in _queryAll
    self._executeRetry(conn, c, s)
  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1824-py2.4.egg/sqlobject/dbconnection.py", line 298, in _executeRetry
    return cursor.execute(query)
TypeError: argument 1 must be str, not unicode

Using Postgresql (psycopg) on Suse 10 and:

Change History

comment:1 Changed 11 years ago by max

from #1001: Problem only happens when using an UnicodeCol? as the label for a ForeignKey?

comment:2 Changed 11 years ago by max

I suppose turbogears.util.to_utf() has to be used in query parameters, see  this for more info.

comment:3 Changed 11 years ago by jorge.vargas

  • Component changed from Toolbox to Toolbox.Catwalk
  • Milestone set to 1.0b4

comment:4 Changed 11 years ago by nyenyec

  • Version set to 1.0b1

I, too see this with turbogears 1.0b1 and Postgresql.

comment:5 Changed 11 years ago by alberto

  • Milestone changed from 1.0b4 to 1.1

comment:6 Changed 11 years ago by alberto

  • Milestone changed from 1.1 to __unclassified__

Batch moved into unclassified from 1.1 to properly track progress on the later

comment:7 Changed 9 years ago by jorge.vargas

  • Milestone changed from __unclassified__ to 1.x

comment:8 Changed 8 years ago by Chris Arndt

  • Owner changed from anonymous to Chris Arndt
  • Keywords needs confirmation, catwalk, unicode, added; catwalk unicode query removed
  • Description modified (diff)
  • Milestone changed from 1.x to 1.0.x bugfix

comment:9 Changed 8 years ago by Chris Arndt

  • Summary changed from Unicode instead of str in SQL query (CatWalk) to CatWalk exception when browsing objects with Unicode name

comment:10 Changed 8 years ago by Chris Arndt

  • Owner changed from Chris Arndt to chrisz

I think I reproduced this on my last ticket cleanup, but unfortunately I didn't record anything here, so please confirm this is still an issue.

comment:11 Changed 8 years ago by chrisz

  • Status changed from new to closed
  • Resolution set to worksforme

I cannot reproduce this with TG 1.0.8 r6808 and SQLObject 0.10.1 (checked with SQLite and Postgres). I have set up a foreign key relationship and let Catwalk display a column with non-ascii chars for the foreign key instead of the id.

There can be problems when the id column is not of type int or str, but I don't know if that's even possible or allowed with SQLObject.

If somebody can still reproduce this issue, please reopen the ticket, post your model code and describe the exact steps in Catwalk leading to the error above.

Note: See TracTickets for help on using tickets.