# Raise a NotmuchError if not initialized
self._verify_initialized_db()
- return notmuch_database_needs_upgrade(self._db)
+ return nmlib.notmuch_database_needs_upgrade(self._db)
def upgrade(self):
"""Upgrades the current database
:param db: An open database which we derive the Query from.
:type db: :class:`Database`
:param querystr: The query string for the message.
- :type querystr: str
+ :type querystr: utf-8 encoded str or unicode
"""
self._db = None
self._query = None
:param db: Database to create the query from.
:type db: :class:`Database`
:param querystr: The query string
- :type querystr: str
+ :type querystr: utf-8 encoded str or unicode
:returns: Nothing
:exception: :exc:`NotmuchError`
raise NotmuchError(STATUS.NOT_INITIALIZED)
# create reference to parent db to keep it alive
self._db = db
-
+ if isinstance(querystr, unicode):
+ # xapian takes utf-8 encoded byte arrays
+ querystr = querystr.encode('utf-8')
# create query, return None if too little mem available
query_p = Query._create(db.db_p, querystr)
if query_p is None:
threads_p = Query._search_threads(self._query)
if threads_p is None:
- NotmuchError(STATUS.NULL_POINTER)
+ raise NotmuchError(STATUS.NULL_POINTER)
return Threads(threads_p,self)