- Python 3 renames `unicode` type to `str` and introduces `bytes` type.
- Python 2.7 has `bytes` but is only an alias for `str` so restricted
to comparisons but helps keep compatibility.
- To test for unicode string on Py2 and Py3 uses the "''.__class__" type.
- Remove usage of utf8encode and just encode, problems with bytes being passed
in code will be picked up faster.
- Where possible refactor out isinstance for try..except duck-typing.
- Switch to using Python 3 naming convention where str now refers to unicode
and bytes are encoded strings.
- Cleanup docs and code
- Also rename convert_to_utf8 to utf8_encode_structure to clarify functionality.
* Added a new convert_to_utf8 function to common that is handy for
any nested dictionaries etc.
* Small refactor to get rid of duplicate code and comment will be
encoded by convert_to_utf8 function.
* Passes test_maketorrent.
* Twisted methods require byte-string arguments.
* The headers str conversion in httpdownloader _download_file was
incorrent and left the dict key still as unicode so replaced with
a dict comprehension (py2.7 requirement).
* Added `from __future__ import unicode_literals` to every file so
now all strings in code are forced to be unicode strings unless
marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`.
This is a large change but we have been working towards the goal of unicode
strings passed in the code so decoding external input and encoding
output as byte strings (where applicable).
Note that in Python 2 the `str` type still refers to byte strings.
* Replaced the use of `str` for `basestring` in isinstance comparison as
this was the original intention but breaks code when encoutering unicode strings.
* Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly
related to gobject signal names.
- Using DYLD_LIBRARY_PATH seems to have the unintended effect of making associated apps
unusable (unable to locate dylds) when opening a file from within Deluge. The workaround
for now is to switch to using DYLD_FALLBACK_LIBRARY_PATH.
* There is a problem with Twisted 17 and the setup for travis and tox
using site-packages with an old openssh package.
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
* The simplest workaround for now is to pin Twisted to 16.6.
- With libtorrent 1.1 dht is enabled from startup and the returned status
contains DHT node values (i.e. non-zero). Should be sufficient to only test for start
and end of the status string to be correct.
- libtorrent 1.1 changes default piece priorty to 4 so changes to
the UIs are required. Some refactoring and improvements were made as well:
- A new 'Low' priority introduced that is values 1-3.
- 'Normal' priority is now value 4.
- Removed 'Highest' with the addition of 'Low' and 'High' is now values 5-7.
- Renamed 'Do not download' to 'Ignore' so it is more succinct.
- Moved file priority constant to ui.common.