aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings/python/notmuch/database.py
Commit message (Collapse)AuthorAge
...
* python: rework creating of SubclassesGravatar Sebastian Spaeth2011-09-30
| | | | | | | | | | | Add some smart magic, so that when we invoke a NotmuchError(STATUSVALUE), a nicely derived subclass is created, e.g. a OutOfMemoryError. This way users can easily distinguish between error types, while still catching NotmuchError. I have tested this, and hope it works for others too. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: provide more exception classesGravatar Justus Winter2011-09-30
| | | | | | | | | | | | | | | | | To make the exception handling more effective in code using the python bindings it is necessary to differentiate between the different kind of failures. Add an exception class for each status code and add a decode classmethod to the NotmuchError class that acts as a factory. Import the new classes in __init__.py so they can be easily imported by anyone. Patch modifed by Sebastian Spaeth. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: Add new functions in API documentationGravatar Sebastian Spaeth2011-09-29
| | | | | | | Add documentation for the three new functions and add in which version they have been added. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Improve code documentationGravatar Sebastian Spaeth2011-09-29
| | | | | | | | 1) Fix added .gitignore from commit dc8a1745 to work on the docs folder 2) Improve in-code developer documentation to produce better sphinx-generated documentation. No code changes. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* properly raise exceptions in python bindingsGravatar Justus Winter2011-09-29
| | | | | | | There are various locations where exceptions are constructed but not raised. This patch adds the necessary raise statements. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: rename _verify_dir_initialized to _assert_dir_is_initializedGravatar Justus Winter2011-09-29
| | | | | | | | | | | Rename the function to clarify its effect and remove all the comments accompanying each call to the function. Modified by Sebastian Spaeth to apply cleanly again and remove some blank lines. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de> Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: rename _verify_initialized_db to _assert_db_is_initializedGravatar Justus Winter2011-09-29
| | | | | | | | | | | Rename the function to clarify its effect and remove all the comments accompanying each call to the function. Modified slightly by Sebastian Spaeth to catch all new instances and remove some blank lines too. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: add begin|end_atomic bindingsGravatar Sebastian Spaeth2011-09-28
| | | | | | | | | * Add UNBALANCED_ATOMIC status code Catch up with the notmuch status codes, and add the UNBALANCED_ATOMIC one. * Add the begin_atomic and end_atomic calls to libnotmuch Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Add database_find_message_by_filename bindingsGravatar Sebastian Spaeth2011-09-28
| | | | | | Add it :-) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Ensure that we pass utf-8 encoded string to libnotmuchGravatar Martin Owens2011-09-16
| | | | | | | | | | | | If we use unicode objects, libnotmuch would not cope with null bytes in the byte array, so we need to make sure they are nicely formatted as utf-8. Introduce a helper function _str which does this throughout the code. Patch slightly modified by Sebastian Spaeth. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Make Database take unicode pathsGravatar Sebastian Spaeth2011-09-05
| | | | | | | | Decode and Encode from/to unicode objects as required to be able to take unicode path names. Previously we would error out when an unicode object were handed it. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: pep8 compliance for database.pyGravatar pazz2011-08-09
|
* python: Really throw an error if search_threads() failsGravatar Sebastian Spaeth2011-08-09
| | | | | | | | | | | | In case, search_threads returns an error we are supposed to throw an Exception. But we did not "raise" it, this was an oversight and this commit fixes it. There is still the problem that there is often output to stderr by libnotmuch detailing the xapian error and this is simply printed out. But this requires fixing at the libnotmuch level... Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Encode query string as a utf-8 byte arrayGravatar Sebastian Spaeth2011-07-11
| | | | | | | | | If we pass in an unicode instance as query string, we would probably get weird behavior (and indeed do so, see mail id:"20110707113700.GA16347@megatron"). If a unicode instance is passed in, make sure we encode it properly to an utf-8 encoded byte string. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Fix Database().needs_upgrade()Gravatar Sebastian Spaeth2011-07-08
| | | | | | | | | A stupid typo was preventing this from ever working and it was not detected until now. Patrick noted the typo and proposed the fix in mail id:"20110704203926.GA20238@brick.lan". Patch-by: Patrick Totzke <patricktotzke@googlemail.com> Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Do not implicitely call maildir_flags_to_tags etcGravatar Sebastian Spaeth2011-06-24
| | | | | | | | | | In order to remain consistent with the underlying C API, we do not automatically synchronize notmuch tags and maildir flags anymore. The underlying functions Message.maildir_flags_to_tags and Message.tags_to_maildir_flags still exist and are available to the user. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Bulletproof Database() path parameterGravatar Sebastian Spaeth2011-06-16
| | | | | | | | | | libnotmuch (and python) crashed when I accidently passed in an invalid value as path argument to the Database() instantiation. Therefore, we now check via assert that the handed in path is actually a real string (or None). Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Implement Message.tags_to_maildir_flagsGravatar Sebastian Spaeth2011-06-16
| | | | | | | | | and also maildir_flags_to_tags. The methods will be invoked by db.add_message() and also (if not overridden via function parameter) by add|remove_tag and remove_all_tags. Documentation on the usage has been updated. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: have docs reflect current return value behaviorGravatar Sebastian Spaeth2010-05-18
| | | | | | | | | | | | Database.find_message() used to be able to reliably indicate whether a message exists or not (in which case it returns None). However, the recent API change of the notmuch library means we will return None even for all Xapian exceptions, which happens e.g. when the current Database has been modified by another project. Therefore the return value of None cannot be reliably be used to indicate whether a message exists or not. Make the docs state that explicitely. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Add UNSORTED as Query.SORT optionGravatar Sebastian Spaeth2010-04-23
| | | | | | Keep up to date with the libnotmuch.so API. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Move everything down into a bindings/python directory.Gravatar Carl Worth2010-04-21
In preparation for merging the python bindings into the notmuch repository.