diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-21 13:23:53 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-21 13:23:53 +0200 |
commit | c9f5bc33f978f5e12669dff0f04082a8967a0a46 (patch) | |
tree | a3c24328d8b7262199125151405b31e72b0ff5e0 | |
parent | Merge branch 'pr/n10_ardi69' into 0.4.10 (diff) | |
download | pyload-c9f5bc33f978f5e12669dff0f04082a8967a0a46.tar.xz |
Spare code cosmetics (10)
-rw-r--r-- | pyload/config/Setup.py | 1 | ||||
-rw-r--r-- | pyload/database/Backend.py | 26 | ||||
-rw-r--r-- | pyload/manager/thread/Server.py | 4 | ||||
-rw-r--r-- | pyload/network/HTTPRequest.py | 2 | ||||
-rw-r--r-- | pyload/plugin/Addon.py | 12 | ||||
-rw-r--r-- | pyload/webui/themes/Next/tml/base.html | 2 |
6 files changed, 26 insertions, 21 deletions
diff --git a/pyload/config/Setup.py b/pyload/config/Setup.py index bae75fea4..f078d54d0 100644 --- a/pyload/config/Setup.py +++ b/pyload/config/Setup.py @@ -524,6 +524,7 @@ class SetupAssistant(object): p2 = getpass("").strip("\n\r") if p1 == p2: + print if self.ask(_("Show password?"), self.no, bool=True): print print _("Your Password is: %s") % p1 diff --git a/pyload/database/Backend.py b/pyload/database/Backend.py index b6540b2be..e851885c0 100644 --- a/pyload/database/Backend.py +++ b/pyload/database/Backend.py @@ -175,18 +175,22 @@ class DatabaseBackend(Thread): f.write(str(DB_VERSION)) return - with open("files.version", "wb+") as f: - v = int(f.read().strip()) - if v < DB_VERSION: - if v < 2: - try: - self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version.")) - except Exception: - print "Filedatabase was deleted due to incompatible version." - remove("files.version") - move("files.db", "files.backup.db") + with open("files.version", "rb") as f: + v = int(f.read().strip() or 0) + + if v < DB_VERSION: + if v < 2: + try: + self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version.")) + except Exception: + print "Filedatabase was deleted due to incompatible version." + remove("files.version") + move("files.db", "files.backup.db") + + with open("files.version", "wb") as f: f.write(str(DB_VERSION)) - return v + + return v def _convertDB(self, v): diff --git a/pyload/manager/thread/Server.py b/pyload/manager/thread/Server.py index 97590013e..6eab58ca7 100644 --- a/pyload/manager/thread/Server.py +++ b/pyload/manager/thread/Server.py @@ -81,7 +81,7 @@ class WebServer(threading.Thread): def start_builtin(self): if self.https: - log.warning(_("This server offers no SSL, please consider using threaded instead")) + log.warning(_("This server offers no SSL, please consider using `threaded` instead")) self.core.log.info(_("Starting builtin webserver: %(host)s:%(port)d") % {"host": self.host, "port": self.port}) webinterface.run_simple(host=self.host, port=self.port) @@ -111,7 +111,7 @@ class WebServer(threading.Thread): def start_lightweight(self): if self.https: - log.warning(_("This server offers no SSL, please consider using threaded instead")) + log.warning(_("This server offers no SSL, please consider using `threaded` instead")) self.core.log.info( _("Starting lightweight webserver (bjoern): %(host)s:%(port)d") % {"host": self.host, "port": self.port}) diff --git a/pyload/network/HTTPRequest.py b/pyload/network/HTTPRequest.py index 92ce6ec4b..74b83cf12 100644 --- a/pyload/network/HTTPRequest.py +++ b/pyload/network/HTTPRequest.py @@ -24,7 +24,7 @@ def myurlencode(data): data = dict(data) return urlencode(dict((encode(x), encode(y)) for x, y in data.iteritems())) -bad_headers = xrange(400, 404) + xrange(405, 418) + xrange(500, 506) +bad_headers = range(400, 404) + range(405, 418) + range(500, 506) class BadHeader(Exception): diff --git a/pyload/plugin/Addon.py b/pyload/plugin/Addon.py index 21a86ab05..66f2c6379 100644 --- a/pyload/plugin/Addon.py +++ b/pyload/plugin/Addon.py @@ -69,7 +69,7 @@ class Addon(Base): self.event_map = None if self.event_list: - self.logWarning(_("Plugin used deprecated 'event_list', use 'event_map' instead")) + self.logWarning(_("Plugin used deprecated `event_list`, use `event_map` instead")) for f in self.event_list: self.manager.addEvent(f, getattr(self, f)) @@ -111,11 +111,11 @@ class Addon(Base): def deactivate(self): """ called when addon was deactivated """ if has_method(self.__class__, "unload"): - self.logWarning(_("Deprecated method 'unload()', use deactivate() instead")) + self.logWarning(_("Deprecated method `unload`, use `deactivate` instead")) self.unload() - def unload(self): #: Deprecated, use method deactivate() instead + def unload(self): #: Deprecated, use method `deactivate` instead pass @@ -130,11 +130,11 @@ class Addon(Base): def activate(self): """ called when addon was activated """ if has_method(self.__class__, "coreReady"): - self.logWarning(_("Deprecated method 'coreReady()', use activate() instead")) + self.logWarning(_("Deprecated method `coreReady`, use `activate` instead")) self.coreReady() - def coreReady(self): #: Deprecated, use method activate() instead + def coreReady(self): #: Deprecated, use method `activate` instead pass @@ -144,7 +144,7 @@ class Addon(Base): self.coreExiting() - def coreExiting(self): #: Deprecated, use method exit() instead + def coreExiting(self): #: Deprecated, use method `exit` instead pass diff --git a/pyload/webui/themes/Next/tml/base.html b/pyload/webui/themes/Next/tml/base.html index 1bc2ea3b3..81c1f3008 100644 --- a/pyload/webui/themes/Next/tml/base.html +++ b/pyload/webui/themes/Next/tml/base.html @@ -180,7 +180,7 @@ <hr style="clear: both;" /> -<div id="foot" style="with: 98%; margin-left: 10px; margin-right:10px">© 2008-2011 pyLoad Team +<div id="foot" style="with: 98%; margin-left: 10px; margin-right:10px">© 2008-2015 pyLoad Team <a href="#top" class="action top" accesskey="x"><span>{{_("Back to top")}}</span></a><br /> <!--<div class="breadcrumbs"></div>--> |