First time here? Check out the FAQ!

Exceptions if apostrophe's in the title

Looking at the log file for askbot, I noticed that an exception is raised when someone puts an apostrophe in the title.

Looks like this is due to the pre-search query executed on psql. Probably because the apostrophe isn't escaped.

Note that the user of the system doesn't get an exception, so that's transparent to them. I think the only issue might be that the pre-search really isn't running at that point.

Here is a trace:

/usr/local/lib/python2.6/site-packages/askbot-0.6.82-py2.6.egg/askbot/middleware/ TIME: 2011-05-17 09:14:28,255
 MSG: <class 'psycopg2.programmingerror'="">
/usr/local/lib/python2.6/site-packages/askbot-0.6.82-py2.6.egg/askbot/middleware/ TIME: 2011-05-17 09:14:28,256
 MSG: syntax error in tsquery: "'No&BSP's&for&th'"

/usr/local/lib/python2.6/site-packages/askbot-0.6.82-py2.6.egg/askbot/middleware/ TIME: 2011-05-17 09:14:29,252
 MSG:   File "/usr/local/lib/python2.6/site-packages/django/core/handlers/", line 99, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.6/site-packages/askbot-0.6.82-py2.6.egg/askbot/utils/", line 56, in wrapper
    return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/site-packages/askbot-0.6.82-py2.6.egg/askbot/views/", line 444, in api_get_questions
    for question in questions:
  File "/usr/local/lib/python2.6/site-packages/django/db/models/", line 107, in _result_iter
  File "/usr/local/lib/python2.6/site-packages/django/db/models/", line 696, in _fill_cache
  File "/usr/local/lib/python2.6/site-packages/django/db/models/", line 239, in iterator
    for row in self.query.results_iter():
  File "/usr/local/lib/python2.6/site-packages/django/db/models/sql/", line 284, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/local/lib/python2.6/site-packages/django/db/models/sql/", line 2347, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.6/site-packages/django/db/backends/", line 19, in execute
    return self.cursor.execute(sql, params)

/usr/local/lib/python2.6/site-packages/askbot-0.6.82-py2.6.egg/askbot/middleware/ TIME: 2011-05-17 09:14:29,253
 MSG: <class 'psycopg2.programmingerror'="">
/usr/local/lib/python2.6/site-packages/askbot-0.6.82-py2.6.egg/askbot/middleware/ TIME: 2011-05-17 09:14:29,253
 MSG: syntax error in tsquery: "'No&BSP's&for&this'"
Evgeny's avatar
updated 2011-05-17 17:30:30 -0500
Benoit's avatar
asked 2011-05-17 09:24:27 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


Fixed in 0.6.87. Thanks for the catch!

Evgeny's avatar
answered 2011-05-17 17:31:04 -0500
edit flag offensive 0 remove flag delete link


add a comment see more comments