diff options
Diffstat (limited to 'pyload/webui/app/pyloadweb.py')
-rw-r--r-- | pyload/webui/app/pyloadweb.py | 17 |
1 files changed, 8 insertions, 9 deletions
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'), |