sync with webui rev87

This commit is contained in:
Marcos Pinto 2007-10-23 22:16:37 +00:00
parent ac00fef1d4
commit a28e33b809
5 changed files with 20 additions and 12 deletions

View File

@ -39,7 +39,6 @@ from webserver_framework import *
import webpy022 as web import webpy022 as web
from webpy022.http import seeother, url from webpy022.http import seeother, url
from webpy022.webapi import setcookie
from webpy022.utils import Storage from webpy022.utils import Storage
from md5 import md5 from md5 import md5

View File

@ -1 +1 @@
57 87

View File

@ -1,5 +1,5 @@
revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk
date: 2007-09-30 10:34:08 +0200 date: 2007-10-23 15:10:08 +0200
build-date: 2007-09-30 10:34:50 +0200 build-date: 2007-10-23 15:34:50 +0200
revno: 57 revno: 87
branch-nick: WebUi branch-nick: WebUi

View File

@ -62,7 +62,7 @@ def init():
REVNO = open(os.path.join(os.path.dirname(__file__),'revno')).read() REVNO = '0.56.stable.' + open(os.path.join(os.path.dirname(__file__),'revno')).read()
VERSION = open(os.path.join(os.path.dirname(__file__),'version')).read() VERSION = open(os.path.join(os.path.dirname(__file__),'version')).read()
TORRENT_KEYS = ['distributed_copies', 'download_payload_rate', TORRENT_KEYS = ['distributed_copies', 'download_payload_rate',

View File

@ -42,7 +42,7 @@ Todo's before stable:
""" """
import webpy022 as web import webpy022 as web
from webpy022.webapi import cookies, setcookie from webpy022.webapi import cookies, setcookie as w_setcookie
from webpy022.http import seeother, url from webpy022.http import seeother, url
from webpy022 import template,changequery as self_url from webpy022 import template,changequery as self_url
@ -54,13 +54,17 @@ from deluge import common
from webserver_common import REVNO, VERSION from webserver_common import REVNO, VERSION
import webserver_common as ws import webserver_common as ws
from debugerror import deluge_debugerror
#init: #init:
web.webapi.internalerror = web.debugerror web.webapi.internalerror = deluge_debugerror
#/init #/init
#methods: #methods:
def setcookie(key, val):
"""add 30 days expires header for persistent cookies"""
return w_setcookie(key, val , expires=2592000)
SESSIONS = [] #dumb sessions. SESSIONS = [] #dumb sessions.
def start_session(): def start_session():
session_id = str(random.random()) session_id = str(random.random())
@ -88,8 +92,13 @@ def error_page(error):
print ws.render.error(error) print ws.render.error(error)
def getcookie(key, default=None): def getcookie(key, default=None):
COOKIE_DEFAULTS = {'auto_refresh_secs':'10'}
key = str(key).strip()
ck = cookies() ck = cookies()
return str(ck.get(key, default)) val = ck.get(key, default)
if (not val) and key in COOKIE_DEFAULTS:
return COOKIE_DEFAULTS[key]
return val
#deco's: #deco's:
def deluge_page_noauth(func): def deluge_page_noauth(func):
@ -327,7 +336,7 @@ def create_webserver(urls,methods):
__all__ = ['deluge_page_noauth', 'deluge_page', 'remote', __all__ = ['deluge_page_noauth', 'deluge_page', 'remote',
'auto_refreshed', 'check_session', 'auto_refreshed', 'check_session',
'do_redirect', 'error_page','start_session','getcookie' 'do_redirect', 'error_page','start_session','getcookie'
,'create_webserver'] ,'create_webserver','setcookie']