Mod_python error: "PythonHandler invenio.webinterface_layout"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/", line 299, in HandlerDispatch
    result = object(req)

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 231, in _handler
    return root._traverse(req, path)

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 191, in _traverse
    result = obj(req, form)

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 112, in __call__
    out = search_engine.perform_request_search(req, **argd)

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 3081, in perform_request_search
    print_records(req, range(recid, recidb), -1, -9999, of, ot, ln, search_pattern=p)

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 2379, in print_records
    temp = {

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 2494, in print_record
    out += call_bibformat(recID, format, ln, search_pattern=search_pattern, uid=uid)

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 2790, in call_bibformat

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 90, in format_record
    out = bibformat_dblayer.get_preformatted_record(recID, of)

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 592, in get_preformatted_record
    res = run_sql(query)

  File "/usr/local/lib/python2.4/site-packages/invenio/", line 54, in run_sql
    rc = cur.execute(sql, param)

  File "build/bdist.linux-i686/egg/MySQLdb/", line 166, in execute

  File "build/bdist.linux-i686/egg/MySQLdb/", line 35, in defaulterrorhandler

ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''''' at line 1")