aboutsummaryrefslogtreecommitdiff
path: root/bindings/python/notmuch/database.py
Commit message (Collapse)AuthorAge
* python: str.decode() doesn't like kwargs in python 2.5Sebastian Spaeth2012-01-02
| | | | | | | | | Recent changes introduced lots of unicodification of strings, mostly in the form of .decode('utf-8', errors='ignore'). However, python 2.5 does not like the errors keyword argument and complains. It does work when used as a simple arg though, so that's what this patch does. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: add missing conversions from and to utf-8Justus Winter2012-01-02
|
* py3k: Rename .next() to __next__(), add python2.x compatibility aliasJustus Winter2012-01-02
|
* py3k: The ConfigParser module has been renamed to configparserJustus Winter2012-01-02
|
* python: Remove stray debug commentSebastian Spaeth2011-12-06
| | | | | | This slipped in wrongly in commit 71e0082eff (due to my fault). Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: use wrapped notmuch_*_t types instead of raw pointersThomas Jost2011-12-06
| | | | | | | | Now that types are checked correctly, we also need to make sure that all the arguments actually are instances of these types. Otherwise the function calls will fail and raise an exception similar to this one: ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: expected LP_LP_NotmuchMessageS instance instead of pointer to c_void_p
* remove unused importsPatrick Totzke2011-12-06
|
* fix sphinx compile-time warningsPatrick Totzke2011-12-06
| | | | | no changes to the code, only makes compiling the docs smoother as some rsT syntax errors were fixed
* pep8 fixesPatrick Totzke2011-12-06
| | | | no changes to the code, only fixed stuff denounced by `pep8 *py`
* python: annotate all calls into libnotmuch with typesJustus Winter2011-12-01
| | | | | | | | | | | Add type information to the ctypes._FuncPtr wrappers and use the wrapper classes instead of c_void_p for pointers to notmuch_*_t. This enables the ctypes library to type check parameters being handed to functions from the notmuch library. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: help function Query._assert_query_is_initializedSebastian Spaeth2011-10-05
| | | | | | | | Remove code duplication by using the new helper function. Also raise the new fine grained exceptions in many cases, rather than the more generic NotmuchErrors. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: clean up docstrings and API documentationSebastian Spaeth2011-10-05
| | | | Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: whitespace fixed in docstringsSebastian Spaeth2011-10-05
| | | | Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Catch up with find_message(by_filename) API changesSebastian Spaeth2011-10-05
| | | | | | | message is now an out parameter, and we get an additional status code as a result. Hurray \o/. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: rework creating of SubclassesSebastian 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 classesJustus 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 documentationSebastian 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 documentationSebastian 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 bindingsJustus 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_initializedJustus 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_initializedJustus 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 bindingsSebastian 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 bindingsSebastian Spaeth2011-09-28
| | | | | | Add it :-) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Ensure that we pass utf-8 encoded string to libnotmuchMartin 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 pathsSebastian 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.pypazz2011-08-09
|
* python: Really throw an error if search_threads() failsSebastian 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 arraySebastian 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()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 etcSebastian 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 parameterSebastian 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_flagsSebastian 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 behaviorSebastian 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 optionSebastian 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.Carl Worth2010-04-21
In preparation for merging the python bindings into the notmuch repository.