From de49037412962cc2ab207627098e37861a92b3fb Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Fri, 11 Jul 2008 18:41:28 +0000 Subject: [PATCH] use deluge.common version in webui --- deluge/ui/webui/debugerror.py | 10 +++------- deluge/ui/webui/render.py | 6 +++--- deluge/ui/webui/templates/deluge/about.html | 2 +- deluge/ui/webui/utils.py | 2 +- deluge/ui/webui/webserver_common.py | 9 --------- 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/deluge/ui/webui/debugerror.py b/deluge/ui/webui/debugerror.py index 3a9f32ec6..ad1f3011d 100644 --- a/deluge/ui/webui/debugerror.py +++ b/deluge/ui/webui/debugerror.py @@ -13,9 +13,6 @@ http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5 __all__ = ["debugerror", "djangoerror"] import utils -print utils -print dir(utils) - pretty_errors_str = { "org.freedesktop.DBus.Error.ServiceUnknown": @@ -43,6 +40,7 @@ from web import template import web #import lib.webpy022.webapi as web import webserver_common as ws from traceback import format_tb +from deluge import common Template = template.Template @@ -344,10 +342,8 @@ def djangoerror(): from render import render return render.error(pretty_errors_cls[exception_type]) - version_info = ( - "WebUi : rev." + ws.REVNO - + "Python : " + str(sys.version) - ) + version_info = "WebUi : %sr%s\nPython %s:" % ( common.get_version() ,common.get_revision(),sys.version) + try: import dbus version_info += '\ndbus:' + str(dbus.__version__) diff --git a/deluge/ui/webui/render.py b/deluge/ui/webui/render.py index 708f512b7..610157891 100644 --- a/deluge/ui/webui/render.py +++ b/deluge/ui/webui/render.py @@ -30,7 +30,7 @@ # statement from all source files in the program, then also delete it here. #relative: -from webserver_common import REVNO, VERSION + from utils import * import utils #/relative @@ -191,8 +191,8 @@ template.Template.globals.update({ 'fsize': common.fsize, 'ftime':ftime, 'render': render, #for easy resuse of templates - 'rev': 'rev.%s' % (REVNO, ), - 'version': VERSION, + 'version':common.get_version() , + 'rev': common.get_revision(), 'getcookie':getcookie, 'get': lambda (var): getattr(web.input(**{var:None}), var), # unreadable :-( #'env':'0.6', diff --git a/deluge/ui/webui/templates/deluge/about.html b/deluge/ui/webui/templates/deluge/about.html index 9e82db43f..42cd6daa7 100644 --- a/deluge/ui/webui/templates/deluge/about.html +++ b/deluge/ui/webui/templates/deluge/about.html @@ -2,7 +2,7 @@ $:render.header(_('About'), 'about') $:render.admin_toolbar('about')

Version

-
$version 
+
$(version)r$rev

Template

Name: $get_config('template')
diff --git a/deluge/ui/webui/utils.py b/deluge/ui/webui/utils.py index dea46280b..eb138f65f 100644 --- a/deluge/ui/webui/utils.py +++ b/deluge/ui/webui/utils.py @@ -49,7 +49,7 @@ from deluge import component from deluge.log import LOG as log from deluge.configmanager import ConfigManager -from webserver_common import REVNO, VERSION, TORRENT_KEYS, CONFIG_DEFAULTS +from webserver_common import TORRENT_KEYS, CONFIG_DEFAULTS from deluge.ui.client import sclient, aclient webui_plugin_manager = component.get("WebPluginManager") diff --git a/deluge/ui/webui/webserver_common.py b/deluge/ui/webui/webserver_common.py index e2b2dee20..30a756d1a 100644 --- a/deluge/ui/webui/webserver_common.py +++ b/deluge/ui/webui/webserver_common.py @@ -34,15 +34,6 @@ webui constants """ import os -try: - REVNO = open(os.path.join(os.path.dirname(__file__),'revno')).read() -except: - REVNO = '' -try: - VERSION = open(os.path.join(os.path.dirname(__file__),'version')).read() -except: - VERSION = '' - TORRENT_KEYS = ['name', 'total_size', 'num_files', 'num_pieces', 'piece_length', 'eta', 'ratio', 'file_progress', 'distributed_copies', 'total_done',