| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
|
|
| |
An assignment `e = os.environ` creates a reference not a copy, which
means that modifying one necessarily modifies the other. Using
`dict.copy` creates a shallow copy (the keys and values are references,
but the dicts are different objects), which means only modifications to
mutable objects are shared. In the case of os.environ which only
contains immutable objects like strings, bools, and numbers this isn't
an issue.
|
|
|
|
|
| |
Since the file is encoded in utf-8 we can actually print the ellipsis.
Most people can more readily read that than the raw utf-8 escape.
|
|
|
|
|
|
|
|
|
| |
This undoes a small subset of the changes from
fa3dd1b04567c4ea03fa658c3838b569531c79f5 and thus fixes #1132.
The io.BytesIO object was not able to handle the unicode header names
that where returned by envelope.construct_mail, which in turn did just
copy them from the envelope header.
|
|
|
|
|
|
|
|
| |
In python3 StringIO and cStringIO are gone. In their place are
io.BytesIO and io.StringIO. They are somewhat different in that they are
not separated on implementation, but on the type they emulated. BytesIO
works like the bytes class (str in python 2), while StringIO works like
the str class (unicode in python2).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The spec is very clear here:
(2) An appropriate Content-Transfer-Encoding is then applied; see
section 3. In particular, line endings in the encoded data
MUST use the canonical <CR><LF> sequence where appropriate
(note that the canonical line ending may or may not be present
on the last line of encoded data and MUST NOT be included in
the signature if absent).
That very last MUST NOT is what's important here, we shouldn't be adding
newlines if they weren't there to begin with. Because we do it causes
signed blobs that have newlines to be invalid since we've changed the
substance of the signed code.
|
| |
|
|
|
|
|
| |
The OSError that is being caught should only be raised by the Popen
constructor: https://docs.python.org/3/library/subprocess.html#exceptions
|
|
|
|
|
| |
This both fixes a test that failed (since stderr wasn't being set) and
simplifies the function to only have one path that uses a ternary.
|
|\
| |
| | |
Remove remaining uses of cmp
|
| |
| |
| |
| |
| |
| | |
This is both a performance issue (since cmp is slower than rich
comparisons), and a python3 issue since cmp (and __cmp__) are gone in
python 3.
|
|\ \
| | |
| | | |
Use __future__.division
|
| |/ |
|
|/
|
|
|
|
|
|
|
|
|
|
| |
Technically a kilobyte (and it's derivatives like megabytes and
gigabytes) are defined as powers of 1000, while a kibibyte (and it's
derivatives like mibibytes and gibibytes) are defined as powers of 1024.
This patch fixes incorrect language and formatting in the humanize_size
function which defined a kilobyte as 1024.
See this wikipedia article for more information:
https://en.wikipedia.org/wiki/Kibibyte
|
|\
| |
| | |
Use absolute_imports from __future__
|
| | |
|
|/ |
|
|\
| |
| | |
Porting old doctests to unittest
|
| | |
|
|/
|
|
|
|
|
|
| |
While the reality is that most alot users probably have glibc as their C
library and can therefore rely on %P, it is possible that there are
users or potential users who run a *BSD or other unix-like OS. This
leaves only non-GNU extensions, though some of the extensions are
specified in later POSIX, unix or C specifications.
|
|
|
|
|
|
|
|
|
|
| |
This patch replaces a large number (but not all) unused arguments with
the standard ``_`` placeholder. This has the advantage of signaling that
these values are unused.
There are a number of places that I've chosen not to apply this, largely
in methods that have publicly define signatures that they inherit
(usually from urwid).
|
|
|
|
|
|
|
|
|
| |
In alot/helper.py this is a fairly obvious change. In alot/buffers.py
I've taken the liberty of replacing a somewhat odd use of multiplication
that relies on the bool class (True and False) implementing an __int__
method. These are used to add the 's' to the end of 'message' if there
are more than one message (thus messages), this is much clearer (and
more correct) when implemented as a ternary instead.
|
|
|
|
| |
This just adds the `r` prefix to a few strings.
|
|
|
|
|
|
|
|
| |
The safely_get helper is just a wrapper around try/except, and is used
twice in the whole code base, in the same function. It really doesn't
even end up saving code because to get around line wrapping a lambda is
assigned (which is not the greatest style wise), it ends up saving one
line of code when it's called, and the function itself is 16 lines long.
|
| |
|
|
|
|
|
|
|
|
| |
While open().read() is nice for its terseness it has the problem that it
causes an fd to leak until the gc collects it. For short lived scripts
this isn't a big deal, but for a program like alot that run for long
periods of time it's better to be correct and ensure that the fd is
closed.
|
|
|
|
|
|
| |
- use relative imports if possible
- group imports into standard library, third party, and alot modules
- sort imports alphabetically
|
| |
|
| |
|
| |
|
|
|
|
|
| |
- the key has been capitalized so compare with "Body" and not "body"
- comparison between strings is better done with == than with "is"
|
| |
|
|
|
|
|
|
|
|
|
| |
The email_as_string function, and the related RFC3156_canonicalize
function, are now used by the ForwardCommand and are not specific
anymore to the crypto routine. So we move them to the global helper
module.
fix an import removal mistake while moving email_as_string function: StringIO was not only used by email_as_string
|
| |
|
|
|
|
|
|
| |
parse_mailto parses mailto strings into headers,body and
mailto_to_envelope constructs an alot.db.envelope.Envelope
for a give mailto string
|
| |
|
|
|
|
|
|
|
|
|
| |
Stripping the string causes leading whitespace on the first line
of a message to be removed leading to weird indentation in thread
view for some html messages.
string_sanitize is also used for mail header parsing but I would
not expect them to contain undesired whitespace too often either.
|
| |
|
|
|
|
| |
workaround
|
| |
|
|
|
|
| |
mostly automatically fixed
|
|
|
|
| |
subprocess.CalledProcessError
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The same lines are in guess_encoding() and guess_mimetype() - so have
guess_mimetype() call guess_encoding()
|
| |
|