summaryrefslogtreecommitdiff
path: root/alot/helper.py
Commit message (Collapse)AuthorAge
* Fix guess_encoding()Hamish Downer2013-04-24
| | | | | | | | Turns out commit 7a9da3b0f obliterated a difference that mattered - the different argument to magic.open() in guess_mimetype() and guess_encoding() This commit reinstates that difference, and has a correct use of the pip python-magic library to get the encoding.
* Add inline comments around magic API hackeryHamish Downer2013-04-04
|
* Support two different versions of magicHamish Downer2013-04-02
| | | | | | The API for magic has changed at some point. Debian and Ubuntu still have an old version, but only the new version can be installed via pip. This commit allows us to use either version.
* Reuse magic mime codeHamish Downer2013-04-02
| | | | | The same lines are in guess_encoding() and guess_mimetype() - so have guess_mimetype() call guess_encoding()
* escape double quotes as wellJohannes Kulick2013-02-19
|
* fix issue with empty authors stringsPatrick Totzke2012-12-02
| | | | | | helper.shorten_authors_string was not able to deal with nonempty whitespaces only as author's realnames. cf issue #530.
* cleanup: pep8/pyflakes fixesPatrick Totzke2012-09-09
|
* doc: docstringsPatrick Totzke2012-09-05
|
* fix issue with shlex removing quotesPatrick Totzke2012-09-03
|
* add split_commandline helperPatrick Totzke2012-09-03
| | | | that splits ;-separated commandlines safely using shlex
* Fix the sorting of tags with length == 1Kazuo Teramoto2012-07-25
| | | | | | The tag sorting `cmp()` put single unicode tags before the long tag names, but don't sort the single length tags. This commit fix this behavior sorting the single length tags separately.
* pep8 and pyflakes fixesPatrick Totzke2012-07-21
|
* doc: fix rtfd.org build: missing coding commentPatrick Totzke2012-06-16
| | | | helper.py usrs utf8 chars and sphinx autodoc complained
* add copyright statements to all source filesPatrick Totzke2012-06-14
| | | | cf issue #472
* add helper split_commandstringPatrick Totzke2012-06-03
| | | | | | | | that splits a command string into a list of strings to pass on to subprocess.Popen and the like. This helper is now used throughout the application instead of calling shlex.split directly as this is a potential source for errors because shlex is not yet able to properly deal with unicode bytestrings.
* fix: sanity check libmagics return valuesPatrick Totzke2012-05-30
| | | | | | | | .. when guessing mimetypes. It turns out that it does not always return proper 'type/subtype' strings. This makes helper.guess_mime_type default to 'application/octett' in those cases. cf. issue #459
* Merge branch '0.3-fix-prettyprint' into stagingPatrick Totzke2012-04-08
|\
| * smarter pretty_datetime helperPatrick Totzke2012-03-31
| | | | | | | | | | | | | | * introduces "just now" for <60sec * Nmin ago for <1hour * uses 12 hour clock for minutes iff am/pm is used by locale * lower case "yest" for yesterdays mails
| * decode strftime return values in pretty_datetimePatrick Totzke2012-03-31
| | | | | | | | | | | | datetime.strftime returns UTF-8 encoded strings, not unicodes. This decodes them for later use. fixes #421
* | add helper.parse_mailcap_nametemplatePatrick Totzke2012-03-28
|/ | | | | that splits a nametemplate string as given in the mailcap sensibly into prefix and suffix
* cleanup: imports in helper.pyPatrick Totzke2012-03-11
|
* group settings into a submodulePatrick Totzke2012-03-11
|
* allow custom checks helper.read_configPatrick Totzke2012-03-11
| | | | | | this makes read_config accept a `checks` dict as parameter which it will add to the validator if validation is used. It allows us to define custom checks ~ value types in our spec
* some cleanupsPatrick Totzke2012-03-02
|
* move read_config to helper; ConfigError to errorsPatrick Totzke2012-02-25
| | | | | | this refactors settings.py to make it more modular: errors.py will contain all exception classes, read_config is moved to helper to reuse in elsewhere
* updated settings docsPatrick Totzke2012-02-19
|
* pep8/pyflakes cleanupPatrick Totzke2012-02-19
|
* remove references to settings from helperPatrick Totzke2012-02-19
| | | | thos should not depend on user settings
* replace config.get_* with settings.getPatrick Totzke2012-02-18
| | | | | this changes all "small" calls to a config getter toa theyr counterparts that call SettingsManager.get
* docs lovePatrick Totzke2012-02-16
|
* log commandlist in helper.call_cmd_asyncPatrick Totzke2012-02-08
| | | | makes debugging easier
* sane fall back for guess_mimetypedPatrick Totzke2012-02-08
| | | | | | | helper.guess_mimetype is expected to return a mimetype string. If libmagic fails it used to return None. This makes it fall back to 'application/octet-stream'. close #313
* Fix the args parameter handed to spawnProcessJustus Winter2012-02-07
| | | | | | | | | Quoting http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorProcess.spawnProcess.html: args - the command line arguments to pass to the process; a sequence of strings. The first string should be the executable's name. Fixes #308, possible more.
* parameter to set ENV vars in call_cmd_asyncPatrick Totzke2012-02-04
| | | | issue #304
* use asyncronous call to sendmailPatrick Totzke2012-02-02
| | | | | in account.send_mail and use call/errbacks in envelope accordingly
* call_cmd_asyncPatrick Totzke2012-02-02
| | | | properly errback after process failed
* add helper call_cmd_async,Patrick Totzke2012-02-01
| | | | | that does as call_cmd before but non-blocking: it returns a deferred that calls back with the requested triple.
* docs: added warning for call_cmd helperPatrick Totzke2012-01-07
|
* pep8Patrick Totzke2012-01-03
|
* Merge pull request #195 from 0x64746b/sorted_searchbuffer_taglistPatrick Totzke2011-12-25
|\ | | | | Sorted searchbuffer taglist
| * Make sorting of tags in SearchBuffer case insensitivedtk2011-12-25
| | | | | | | | | | | | | | | | | | | | | | | | Preserve property that single char tags are always displayed before all other tags. So far the sorting of tags in a ThreadlineWidget was case sensitive: ['✉', 'Notmuch', 'alot', 'xapian']. Now the sorting is case insensitive but still treats single char tags preferentially: ['✉', 'alot', 'Notmuch', 'xapian'] Cf issues #190, #109 and #77.
* | Remove unused function helper.guess_mimetype_of_pathJustus Winter2011-12-25
| |
* | Decode the text message according to the encoding guessed by libmagic in ↵Justus Winter2011-12-25
| | | | | | | | helper.mimewrap
* | Add helper.guess_encodingJustus Winter2011-12-25
| |
* | Avoid reading the file twice if we have to guess the content typeJustus Winter2011-12-25
|/
* more generic guess_mimetype and docsPatrick Totzke2011-12-23
| | | | | | this can be called with arbitrary data blobs and will be reused throughout the interface issue #172
* use magic™ to detect mimetypes for filesPatrick Totzke2011-12-23
| | | | | | this introduces helper.guess_mimetype, that uses the `file` type determination library issue #172
* pep8/pyflakes fixesPatrick Totzke2011-12-21
|
* fix typo in call_cmd helperPatrick Totzke2011-12-21
|
* merge helper.cmd_output and pipe_commandPatrick Totzke2011-12-21
|