webui sync 117

This commit is contained in:
Marcos Pinto 2007-10-31 03:46:36 +00:00
parent 2a9455e50a
commit 99065bf452
6 changed files with 35 additions and 21 deletions

View File

@ -134,7 +134,7 @@ class DbusManager(dbus.service.Object):
"""same as 0.6 interface"""
for torrent_id in torrents:
torrent_id = int(torrent_id)
self.core.set_user_pause(torrent_id,True)
self.core.set_user_pause(torrent_id, True)
@dbus.service.method(dbus_interface=dbus_interface,
in_signature="as", out_signature="")
@ -142,7 +142,15 @@ class DbusManager(dbus.service.Object):
"""same as 0.6 interface"""
for torrent_id in torrents:
torrent_id = int(torrent_id)
self.core.set_user_pause(torrent_id,False)
self.core.set_user_pause(torrent_id, False)
@dbus.service.method(dbus_interface=dbus_interface,
in_signature="as", out_signature="")
def force_reannounce(self, torrents):
"""same as 0.6 interface"""
for torrent_id in torrents:
torrent_id = int(torrent_id)
self.core.update_tracker(torrent_id)
@dbus.service.method(dbus_interface=dbus_interface,
in_signature="sbb", out_signature="")

View File

@ -47,18 +47,19 @@ urls = (
"/index(.*)", "index",
"/torrent/info/(.*)", "torrent_info",
"/torrent/pause(.*)", "torrent_pause",
"/torrent/reannounce/(.*)", "torrent_reannounce",
"/torrent/add(.*)", "torrent_add",
"/torrent/delete/(.*)", "torrent_delete",
"/torrent/queue/up/(.*)", "torrent_queue_up",
"/torrent/queue/down/(.*)", "torrent_queue_down",
"/pause_all(.*)", "pause_all",
"/resume_all(.*)", "resume_all",
"/pause_all", "pause_all",
"/resume_all", "resume_all",
"/refresh/set(.*)", "refresh_set",
"/refresh/(.*)", "refresh",
"/config(.*)","config",
"/home(.*)", "home",
"/about(.*)", "about",
"/logout(.*)", "logout",
"/config","config",
"/home", "home",
"/about", "about",
"/logout", "logout",
#remote-api:
"/remote/torrent/add(.*)", "remote_torrent_add",
#static:
@ -66,8 +67,8 @@ urls = (
"/template/static/(.*)","template_static",
#"/downloads/(.*)","downloads" disabled until it can handle large downloads.
#default-pages
"/(.*)", "home",
"(.*)", "home"
"/", "home",
"", "home"
)
#/routing
@ -93,7 +94,7 @@ class login:
class index:
"page containing the torrent list."
@deluge_page
@auto_refreshed
@auto_refreshed
def GET(self, name):
vars = web.input(sort=None, order=None)
@ -113,7 +114,7 @@ class index:
class torrent_info:
@deluge_page
@auto_refreshed
@auto_refreshed
def GET(self, torrent_id):
return ws.render.torrent_info(get_torrent_status(torrent_id))
@ -125,7 +126,12 @@ class torrent_pause:
ws.proxy.pause_torrent([vars.stop])
elif vars.start:
ws.proxy.resume_torrent([vars.start])
do_redirect()
class torrent_reannounce:
@check_session
def POST(self, torrent_id):
ws.proxy.force_reannounce([torrent_id])
do_redirect()
class torrent_add:

View File

@ -1 +1 @@
115
117

View File

@ -81,7 +81,7 @@ class="deluge_button">
</form>
$:render.part_button('GET', '/torrent/delete/' + str(torrent.id), _('Remove'), 'tango/user-trash.png')
$:render.part_button('POST', '/torrent/reannounce/' + str(torrent.id), _('Reannounce'), 'tango/view-refresh.png')
<br>
<!--

View File

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

View File

@ -84,7 +84,7 @@ def start_session():
setcookie("session_id", session_id)
def end_session():
session_id = getcookie("session_id")
session_id = getcookie("session_id")
#if session_id in ws.SESSIONS:
# ws.SESSIONS.remove(session_id)
#not thread safe! , but a verry rare bug.
@ -136,7 +136,7 @@ def check_session(func):
a decorator
return func if session is valid, else redirect to login page.
"""
def deco(self, name):
def deco(self, name=None):
vars = web.input(redir_after_login=None)
ck = cookies()
if ck.has_key("session_id") and ck["session_id"] in ws.SESSIONS:
@ -153,7 +153,7 @@ def deluge_page(func):
#combi-deco's:
def auto_refreshed(func):
"decorator:adds a refresh header"
def deco(self, name):
def deco(self, name=None):
if getcookie('auto_refresh') == '1':
web.header("Refresh", "%i ; url=%s" %
(int(getcookie('auto_refresh_secs',10)),self_url()))
@ -162,7 +162,7 @@ def auto_refreshed(func):
def remote(func):
"decorator for remote api's"
def deco(self, name):
def deco(self, name=None):
try:
print func(self, name)
except Exception, e: