Commit graph

44 commits

Author SHA1 Message Date
Calum Lind
84802da29b [Py2to3] Force unicode_literals and fix related issues
* 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.
2017-02-22 12:36:32 +00:00
Calum Lind
3a2ff0c188 [Lint] Convert all python double quotes to single quotes
* A rather disruptive change but for a few reasons such as easier to read,
   easier type, keep consistent and javascript code uses single quotes.
 * There are a few exceptions for the automated process:
    * Any double quotes in comments
    * Triple double quotes for docstrings
    * Strings containing single quotes are left e.g. "they're"

 * To deal with merge conflicts from feature branches it is best to follow
   these steps for each commit:
     * Create a patch: `git format-patch -1 <sha1>`
     * Edit the patch and replace double quotes with single except those in
       comments or strings containing an unescaped apostrophe.
     * Check the patch `git apply --check <patchfile>` and fix any remaining
       issues if it outputs an error.
     * Apply the patch `git am < <patchfile>`
2016-11-03 21:45:45 +00:00
bendikro
59d8fc9a14 [Lint] Fix pylint warnings 2016-11-03 10:31:38 +00:00
Calum Lind
3f72905b3f Revert "[Py2to3] Clean-up the use of keys() on dictionary objects."
This reverts commit 8b50f3cdbd.
2016-10-26 19:14:10 +01:00
Andrew Resch
8b50f3cdbd [Py2to3] Clean-up the use of keys() on dictionary objects.
To make the code more Python 3 compatible, I've made a few changes to how we handle keys() or iterkeys() calls on dictionaries. All functionality should remain the same.

 * Remove the use of .keys() or .iterkeys() when iterating through a dictionary.
 * Remove the use of .keys() when checking if key exists in dictionary.
 * Replace dict.keys() with list(dict) to obtain a list of dictionary keys. In Python 3 dict.keys() returns a dict_keys object, not a list.
2016-10-26 09:53:32 +01:00
bendikro
70d8b65f0a [WebUi] [Core] Fixes to plugin handling and WebUi plugin + tests
This should fix problems with errors occuring when failing to
enable plugins. Errors in plugin handling are handled better
and properly logged.

WebUI plugin in particular had issues when being enabled and disabled
multiple times because it was trying to create DelugeWeb component
each time it was enabled. If deluge-web is already listening on
the same port, enabling the WebUI plugin will fail, and the checkbox
will not be checked.

There are still some issues when enabling/disabling plugins by
clicking fast multiple times on the checkbox.
2016-04-18 15:49:30 +01:00
Calum Lind
2583e9d888 [Lint] Code cleanup for PyLint run by prospector tool
* Fix for pluginmanager multiple inheritance which in this case is using super incorrectly.
 * Explicitly disable pylint 'pointless-except' and 'super-on-old-class' that prospector
   tool somehow runs.
 * Make __all__ a tuple to supress pep257 warning.
 * Add a noqa for older versions of pyflakes.
2015-10-30 18:39:57 +00:00
Calum Lind
807fa609f9 [Lint] Cleanup code to pass PyLint Warning category
Selected Warning messages disabled in pylintrc:
  * unused-argument: Quite a large and disruptive change if enabled.
  * broad-except: Most required in-depth investigation to determine type.
  * fixme: Not important
  * protected-access: Complicated to fix
  * import-error: Too many false-positives
  * unidiomatic-typecheck: Should be fixed in the next round of checks.
  * unused-variable: Again large and disruptive changes.
  * global-statement: Most usage is required.
  * attribute-defined-outside-init: Should be fixed in next round of checks.
  * arguments-differ: Possible false-positives, needs revisited.
  * no-init, non-parent-init-called, super-init-not-called: False-positives?
  * signature-differs: False-positives?
2015-10-30 18:39:47 +00:00
Calum Lind
8241b2ba3e [Core] Return all plugin status keys with empty list 2015-09-28 12:20:35 +01:00
Calum Lind
fc9017cfb1 Update with new license header 2014-09-19 19:21:42 +01:00
Calum Lind
b5dcfc6f9e Sort/prettify imports with isort 2014-09-03 18:27:32 +01:00
Calum Lind
1e6c811768 [Python-Modernize] lib2to3.fixes.fix_except
* Use 'ex' instead of 'e' to conform with pylint
 * Minimal Flake8 on some files
2014-09-03 17:22:38 +01:00
Calum Lind
c3477ace9b Flake8'd core files 2014-01-18 23:26:18 +00:00
Andrew Resch
9ac0d62149 Remove some imports that are no longer neccessary 2011-02-23 11:21:47 -08:00
Pedro Algarvio
3b00a7de59 Swhiched the old style logging, ie, a single logger for all logging output to several loggers. This brings the ability to tweak the logging levels for each of the loggers, ie, we can have the "deluge" logger be at the ERROR level while having "deluge.core" at the DEBUG level, meaning we will only see log message for all of the deluge loggers above the ERROR level while still having all messages above the DEBUG level for the "deluge.core" logger and it's children. This kind of tweak can be achieved by adding a file named "logging.conf" to deluge's config dir and this is explained on the deluge.log.tweak_logging_levels function.
Passing `-r` to the cli's while also passing `-l` will make the logfile rotate when reaching 5Mb in size. Three backups will be kept at all times.
All deluge's code is now using this new style logging along with the git hosted plugins. For other plugins not hosted by deluge, which still imports `LOG` as the logger, a deprecation warning will be shown explaining the required changes needed to use the new style logging. New plugins created by the `create_plugin` script will use the new logging facilities.
2010-12-06 11:20:22 +00:00
Andrew Resch
25afa04ba3 Use torrent status diffs in the TorrentView to reduce the amount of rpc
traffic from the core->gtkui
2010-01-25 00:15:12 +00:00
Andrew Resch
f10bf6961b Add PluginEnabledEvent
Add PluginDisabledEvent
Add event handlers to enable/disable plugins on events
2009-08-26 16:59:29 +00:00
Andrew Resch
d67477f6e2 Add OpenSSL exception to all GPL headers 2009-05-18 21:51:49 +00:00
Andrew Resch
930c479718 Remove the plugin hooks from the Core.. These are replaced by Events 2009-03-15 20:29:51 +00:00
Andrew Resch
f6c26d6690 Remove timer in pluginmanager since update calls will be handled by
component now
2009-02-28 17:20:49 +00:00
Andrew Resch
e0735cf5ca Only attempt stopping PluginManagers looping call if it's running. 2009-02-03 06:39:33 +00:00
Andrew Resch
6a0594b47d Rename the daemons PluginManager component to CorePluginManager to not
conflict with the gtkui in Classic mode.
2009-01-28 23:10:44 +00:00
Andrew Resch
42588656fd Implement new DelugeRPC method to replace XMLRPC.
This commit breaks _a lot_ of things including the web and console UIs, please do not expect 
anything to work.
2009-01-27 08:03:39 +00:00
Andrew Resch
c6ddaeaac7 Remove OpenSSL exception from license headers 2008-11-23 04:58:01 +00:00
Andrew Resch
a0bf6d8fe1 Remove trailing whitspace from *.py 2008-11-17 00:57:32 +00:00
Marcos Pinto
6fa31d1dc0 change copyright notices to gpl3 2008-08-08 05:59:07 +00:00
Andrew Resch
ae0652227b Add post_session_load() plugin hook. This change does break
persistent.state.
Add some queue exports and stuff to the core.
2008-02-25 00:05:09 +00:00
Andrew Resch
1f5d9a10c1 Expose reset_ip_filter() to plugins. 2008-02-21 04:20:30 +00:00
Andrew Resch
2eec78f9fb Expose block_ip_range() to plugins. 2008-02-17 05:51:07 +00:00
Andrew Resch
8271d70ec7 Plugin system changes in regards to enabling/disabling plugins. 2007-12-11 04:45:47 +00:00
Andrew Resch
f3cdfa8351 Fix Queue plugin loading when state file is wrong. 2007-12-11 01:35:36 +00:00
Andrew Resch
78b78ce8b3 Use deluge.component for core components. 2007-12-10 10:49:42 +00:00
Andrew Resch
cfc05729ee Queue plugin updates. 2007-11-04 23:54:38 +00:00
Andrew Resch
eacc6dd08f Queue plugin update.
Plugin system updates.
2007-11-03 07:24:45 +00:00
Andrew Resch
5d3275de01 Some plugin updates. 2007-10-31 08:16:35 +00:00
Andrew Resch
06e148c2ed Add PluginManagerBase class.
Only load plugins that are in the 'enabled_plugins' key in the config 
files.
2007-10-04 00:43:41 +00:00
Andrew Resch
cb0505405d Clean-up. 2007-08-29 08:02:06 +00:00
Andrew Resch
c5d76cf8ee State saving and loading in core and TorrentQueue.
GtkUI now requests a 'session_state' on start-up to populate it's 
listview.
GtkUI can now shutdown core.
2007-08-29 08:00:19 +00:00
Andrew Resch
6a525530ee Big code clean-up and some refactoring. Added docstrings but more are
needed.
2007-08-26 14:34:50 +00:00
Andrew Resch
f185f19cfb Plugins can now register 'status_fields' with core for use with
get_status().
Updates to TorrentQueue plugin.
2007-08-22 08:24:40 +00:00
Andrew Resch
e13b42203b Start of move to generic ListView. Not really functional yet. 2007-08-12 07:01:27 +00:00
Andrew Resch
895f7e2761 Add missing files.
Start of plugin support in gtkui.
2007-08-11 06:46:41 +00:00
Andrew Resch
13fc181fa2 More work on the queue torrent plugin and plugins in general. 2007-08-10 08:15:02 +00:00
Andrew Resch
78e225526c 'Hack' in plugin support. This is totally wrong, but it sort of works. 2007-08-05 20:03:00 +00:00