From 48d7632c3ae5891005118f6beb7ba98370d517e8 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Fri, 31 Jul 2009 01:26:33 -0400 Subject: [PATCH] Validate better. --- httpserver.py | 16 ++++++++-------- plugins/settings/settings.py | 9 +++++---- plugins/settings/templates/settings.tmpl | 8 +++++--- plugins/togo/templates/npl.tmpl | 21 +++++++++++---------- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/httpserver.py b/httpserver.py index ebdd7ea..a42a3e6 100644 --- a/httpserver.py +++ b/httpserver.py @@ -205,33 +205,33 @@ class TivoHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): t.admin = '' if config.get_server('tivo_mak') and config.get_server('togo_path'): - t.togo = '
Pull from TiVos:
' + t.togo = '
Pull from TiVos:
' else: t.togo = '' if (config.get_server('tivo_username') and config.get_server('tivo_password')): - t.shares = '
Push from video shares:
' + t.shares = '
Push from video shares:
' else: t.shares = '' for section in shares: plugin_type = shares[section].get('type') if plugin_type == 'settings': - t.admin += ('Web Configuration
') elif plugin_type == 'togo' and t.togo: for tsn in config.tivos: if tsn: t.togo += ('' + - config.tivo_names[tsn] + '
') + 'Command=NPL&Container=' + quote(section) + + '&TiVo=' + config.tivos[tsn] + '">' + + config.tivo_names[tsn] + '
') elif plugin_type == 'video' and t.shares: t.shares += ('' + section + '
') + 'QueryContainer&Container=' + + quote(section) + '">' + section + '
') self.wfile.write(t) diff --git a/plugins/settings/settings.py b/plugins/settings/settings.py index 2857e7d..458d24b 100644 --- a/plugins/settings/settings.py +++ b/plugins/settings/settings.py @@ -17,13 +17,13 @@ CLASS_NAME = 'Settings' RESET_MSG = """

The pyTivo Server has been soft reset.


pyTivo has reloaded the pyTivo.conf file and all changes should now be in effect.
-The previous page +The previous page will reload in 3 seconds.""" SETTINGS_MSG = """

Your Settings have been saved.


Your settings have been saved to the pyTivo.conf file. However you will need to do a Soft Reset before these changes will take effect.
-The Settings page +The Settings page will reload in 10 seconds.""" # Preload the templates @@ -46,7 +46,8 @@ class Settings(Plugin): cname = query['Container'][0].split('/')[0] t = Template(REDIRECT_TEMPLATE) t.time = '3' - t.url = '/TiVoConnect?Command='+ last_page +'&Container=' + quote(cname) + t.url = ('/TiVoConnect?Command=' + last_page + '&Container=' + + quote(cname)) t.text = RESET_MSG % (quote(last_page), quote(cname)) handler.send_response(200) handler.send_header('Content-Type', 'text/html') @@ -148,7 +149,7 @@ class Settings(Plugin): cname = query['Container'][0].split('/')[0] t = Template(REDIRECT_TEMPLATE) t.time = '10' - t.url = '/TiVoConnect?Command=Settings&Container=' + quote(cname) + t.url = '/TiVoConnect?Command=Settings&Container=' + quote(cname) t.text = SETTINGS_MSG % quote(cname) handler.send_response(200) handler.send_header('Content-Type', 'text/html') diff --git a/plugins/settings/templates/settings.tmpl b/plugins/settings/templates/settings.tmpl index 0a48b63..4284327 100644 --- a/plugins/settings/templates/settings.tmpl +++ b/plugins/settings/templates/settings.tmpl @@ -197,7 +197,7 @@ function saveNotify() vertical-align: top;">
-
Sections + Sections
+ onclick="switchDiv('set-add', 'set-');return true;"> +
Administration -
+

+
diff --git a/plugins/togo/templates/npl.tmpl b/plugins/togo/templates/npl.tmpl index f779884..83f3d9d 100644 --- a/plugins/togo/templates/npl.tmpl +++ b/plugins/togo/templates/npl.tmpl @@ -23,12 +23,12 @@ #if $Offset < -($shows_per_page+1) #set $Offset = -($shows_per_page+1) #end if - Previous Page + Previous Page #end if #if $folder != '' - + #end if #set $i = 0 @@ -43,7 +43,7 @@ #if $row['ContentType'] == 'x-tivo-container/folder' - + @@ -64,7 +64,7 @@ #end if - #else @@ -117,7 +118,7 @@
Back to Now Playing List
Back to Now Playing List
$row['Title'] $row['Title'] $(row["TotalItems"]) Items $row["LastChangeDate"] + #if 'episodeTitle' in $row $row['title']: $row['episodeTitle']
#else @@ -74,8 +74,9 @@ $row['description'] #end if #if 'displayMajorNumber' in $row and 'callsign' in $row - $row['displayMajorNumber'] $row['callsign'] + $row['displayMajorNumber'] $row['callsign'] #end if +
$row['SourceSize']
$row['Duration'] @@ -90,21 +91,21 @@ #if $this_status['running'] and $this_status['rate'] != "" #set $gb = '%.3f GB' % (float($this_status['size']) / (1024 ** 3)) Transfering - $this_status['rate'] KB/s
$gb - Stop Transfer + Stop Transfer #elif $this_status['running'] and $this_status['rate'] == "" Initiating Transfer.
Please Wait #elif $this_status['error'] Error - $this_status['error']
- Try Transfer Again. + Try Transfer Again. #elif $this_status['finished'] Transfer Complete #else Transfer Stopped
- Try Transfer Again. + Try Transfer Again. #end if #else - Transfer This. + Transfer This. #end if
#if ($TotalItems - $ItemCount) > ($ItemStart + 1) #set $Offset = $shows_per_page - 1 - Next Page + Next Page #end if -- 2.11.4.GIT