X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Fdatabase.py;h=84cf79bbad13f90e8d438bb51d4fac44a818bf4a;hp=5deb2a5dc06a62cb8d97096b376baf44812c7648;hb=504b6242d1fd67d04ee236fc92a54ca39fd682f7;hpb=e59eaa5ddd2c23742c95e2acd34673b58ea34d2d diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 5deb2a5d..84cf79bb 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -195,7 +195,7 @@ class Database(object): # 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 @@ -501,7 +501,7 @@ class Query(object): :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 @@ -517,7 +517,7 @@ class Query(object): :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` @@ -529,7 +529,9 @@ class Query(object): 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: