aboutsummaryrefslogtreecommitdiff
path: root/bindings/python/notmuch/tag.py
Commit message (Collapse)AuthorAge
* python: use relative importsJustus Winter2012-05-17
| | | | Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: cleanup the __nonzero__ implementationsJustus Winter2012-04-30
| | | | | | | | | | | Cleanup the code, reword the docstring and use the same implementation in the Threads, Tags and Messages classes. __nonzero__ implements truth value testing. If __nonzero__ is not implemented, the python runtime would fall back to `len(..) > 0` thus exhausting the iterator. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: fix NULL pointer testsJustus Winter2012-04-30
| | | | | | | Fix the NULL pointer tests in the destructors of all classes and Database.create. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: strip superfluous single quote from copyright noticesJustus Winter2012-04-29
| | | | Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: move the exception classes into error.pyJustus Winter2012-02-23
| | | | Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: refactor the error handling machineryJustus Winter2012-02-20
| | | | | | | | Raise specific error classes instead of a generic NotmuchError with an magic status value (e.g. NotmuchError(STATUS.NULL_POINTER) -> NullPointerError()), update the documentation accordingly. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: more error handling fixesJustus Winter2012-02-19
| | | | | | | This is a follow up commit to 221c7e0b38177f5f1dbf0561580c15e8aaa49004 fixing more NULL pointer checks. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: remove unused but imported symbolJustus Winter2012-02-18
| | | | Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
* python: fix error handlingJustus Winter2012-01-22
| | | | | | | | | | | Before 3434d1940 the return values of libnotmuch functions were declared as c_void_p and the code checking for errors compared the returned value to None, which is the ctypes equivalent of a NULL pointer. But said commit wrapped all the data types in python classes and the semantic changed in a subtle way. If a function returns NULL, the wrapped python value is falsish, but no longer equal to None.
* py3k: Add and use a mixin class that implements __str__Justus Winter2012-01-02
| | | | | Amended by Sebastian Spaeth <Sebastian@SSpaeth.de> to include the required sys import in globals.py.
* py3k: Rename .next() to __next__(), add python2.x compatibility aliasJustus Winter2012-01-02
|
* use __unicode__ for string representationPatrick 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
* 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>
* 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: Fix unsafe utf-8 decodingspazz2011-08-17
| | | | | | | | This prevents unsafe calls to decode for return value None in get_authors/get_subject which would current throw an Exception. Original patch modified by Sebastian Spaeth. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: remove Tags().__len__() implementationSebastian Spaeth2011-08-09
| | | | | | | | | | | len() exhausts the tag iterator and e.g. list() or "".join(tags) implicitly call len() if existing and then failing. So, we remove Tags.__len__(). If you need to know the number of tags a message has, do use len(list(tags)). It would be nicer to be able to support len() directly... Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: Do explicitly check if the next tag existsSebastian Spaeth2011-08-09
| | | | | | | | If we try to pull a non-existing tag, Tags._get will return None and the appended .decode() command will fail. So make sure that there is a tag to be fetched before fetching it. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: pep8 compliance for tag.pypazz2011-08-09
|
* python: Fix copy'n paste typoCedric Cabessa2011-08-09
| | | | | | | we accessed a wrong attribute due to a copy and paste error. Thanks for catching this. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* python: represent message tags as unicode instancesSebastian Spaeth2011-07-11
| | | | | | | | | | | | Rather than returning simply strings and having to guess their encoding, return explicit unicode() strings for the tags. Xapian stores UTF8, so we know that they come as UTF8 encoded string. Note: I tried to directly use the c_wchar_p type of the ctypes library which translates directly into an unicode type, but that did not work out so well, so we take c_char_p and .decode() them manually. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* bindings/python: Implement Tags().__nonzero__()Sebastian Spaeth2011-06-02
| | | | | | | | Analog to Threads.__nonzero__ this allows us to perform list() on a Threads() object and to repeatedly call "if Tags():" or "bool(Tags())" without implicitly invoking len(), thus exhausting our iterator. While touching this code, I added a small micro-optimization to the Tag next() function. There is no need to explicitly check _is_valid, as _get implicitly does check for validness and returns None, if there is no more Tag to fetch. This avoids some roundtrips into the library when iterating through Tags. 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.