summaryrefslogtreecommitdiffstats
path: root/pyload/webui
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-12 02:44:03 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-12 03:22:38 +0200
commitf8cf65d4271254dd89662cb6190adc5b426c6d2b (patch)
tree3197abaa2f3a7f1fdc4f2edcd1844087780c066a /pyload/webui
parent'from time' -> 'import time' and so on... (diff)
downloadpyload-f8cf65d4271254dd89662cb6190adc5b426c6d2b.tar.xz
'from time' -> 'import time' and so on... (2)
Diffstat (limited to 'pyload/webui')
-rw-r--r--pyload/webui/app/cnl.py4
-rw-r--r--pyload/webui/app/pyloadweb.py17
2 files changed, 10 insertions, 11 deletions
diff --git a/pyload/webui/app/cnl.py b/pyload/webui/app/cnl.py
index c02e0d1ff..7202a2db4 100644
--- a/pyload/webui/app/cnl.py
+++ b/pyload/webui/app/cnl.py
@@ -2,11 +2,11 @@
from __future__ import with_statement
+import base64
import os
import re
import urllib
-from base64 import standard_b64decode
from binascii import unhexlify
from bottle import route, request, HTTPError
@@ -80,7 +80,7 @@ def addcrypted2():
crypted = request.forms['crypted']
jk = request.forms['jk']
- crypted = standard_b64decode(urllib.unquote(crypted.replace(" ", "+")))
+ crypted = base64.standard_b64decode(urllib.unquote(crypted.replace(" ", "+")))
if JS:
jk = "%s f()" % jk
jk = JS.eval(jk)
diff --git a/pyload/webui/app/pyloadweb.py b/pyload/webui/app/pyloadweb.py
index 316717b26..8974e0896 100644
--- a/pyload/webui/app/pyloadweb.py
+++ b/pyload/webui/app/pyloadweb.py
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
# @author: RaNaN
+import datetime
import os
import sys
import time
import urllib
-from datetime import datetime
from operator import itemgetter, attrgetter
-from sys import getfilesystemencoding
from bottle import route, static_file, request, response, redirect, error
@@ -348,10 +347,10 @@ def os.path(file="", path=""):
for f in folders:
try:
- f = f.decode(getfilesystemencoding())
+ f = f.decode(sys.getfilesystemencoding())
data = {'name': f, 'fullpath': os.path.join(cwd, f)}
data['sort'] = data['fullpath'].lower()
- data['modified'] = datetime.fromtimestamp(int(os.path.getmtime(os.path.join(cwd, f))))
+ data['modified'] = datetime.datetime.fromtimestamp(int(os.path.getmtime(os.path.join(cwd, f))))
data['ext'] = os.path.splitext(f)[1]
except Exception:
continue
@@ -401,7 +400,7 @@ def logs(item=-1):
if request.environ.get('REQUEST_METHOD', "GET") == "POST":
try:
- fro = datetime.strptime(request.forms['from'], '%d.%m.%Y %H:%M:%S')
+ fro = datetime.datetime.strptime(request.forms['from'], '%d.%m.%Y %H:%M:%S')
except Exception:
pass
try:
@@ -427,7 +426,7 @@ def logs(item=-1):
if item < 1 or type(item) is not int:
item = 1 if len(log) - perpage + 1 < 1 else len(log) - perpage + 1
- if type(fro) is datetime: #: we will search for datetime
+ if type(fro) is datetime.datetime: #: we will search for datetime.datetime
item = -1
data = []
@@ -439,7 +438,7 @@ def logs(item=-1):
if counter >= item:
try:
date, time, level, message = l.decode("utf8", "ignore").split(" ", 3)
- dtime = datetime.strptime(date + ' ' + time, '%Y-%m-%d %H:%M:%S')
+ dtime = datetime.datetime.strptime(date + ' ' + time, '%Y-%m-%d %H:%M:%S')
except Exception:
dtime = None
date = '?'
@@ -447,7 +446,7 @@ def logs(item=-1):
level = '?'
message = l
if item == -1 and dtime is not None and fro <= dtime:
- item = counter #: found our datetime
+ item = counter #: found our datetime.datetime
if item >= 0:
data.append({'line': counter, 'date': date + " " + time, 'level': level, 'message': message})
perpagecheck += 1
@@ -457,7 +456,7 @@ def logs(item=-1):
break
if fro is None: #: still not set, empty log?
- fro = datetime.now()
+ fro = datetime.datetime.now()
if reversed:
data.reverse()
return render_to_response('logs.html', {'warning': warning, 'log': data, 'from': fro.strftime('%d.%m.%Y %H:%M:%S'),