Author: duncan
Date: Fri Jan 5 23:29:04 2007
New Revision: 8936
Modified:
branches/rel-1/freevo/src/helpers/webserver.py
branches/rel-1/freevo/src/www/htdocs/fileinfo.rpy
branches/rel-1/freevo/src/www/htdocs/library.rpy
Log:
Webserver clean up and fix for trailing slash
Patches from Chandan Pitta applied
Modified: branches/rel-1/freevo/src/helpers/webserver.py
==============================================================================
--- branches/rel-1/freevo/src/helpers/webserver.py (original)
+++ branches/rel-1/freevo/src/helpers/webserver.py Fri Jan 5 23:29:04 2007
@@ -92,20 +92,17 @@
root = static.File(docRoot)
root.processors = { '.rpy': script.ResourceScript, }
- for item in config.VIDEO_ITEMS:
- if isinstance(item, tuple) and len(item) == 2:
- (title, path) = item
- root.putChild(path.replace("/", "_"), static.File(path))
- for item in config.AUDIO_ITEMS:
- if isinstance(item, tuple) and len(item) == 2:
- (title, path) = item
- root.putChild(path.replace("/", "_"), static.File(path))
- for item in config.IMAGE_ITEMS:
+
+ child_resources = []
+ child_resources.extend(config.VIDEO_ITEMS)
+ child_resources.extend(config.AUDIO_ITEMS)
+ child_resources.extend(config.IMAGE_ITEMS)
+ child_resources.extend([('Recorded TV', config.TV_RECORD_DIR)])
+ child_resources.extend([('Webserver Cache', config.WEBSERVER_CACHEDIR)])
+ for item in child_resources:
if isinstance(item, tuple) and len(item) == 2:
(title, path) = item
root.putChild(path.replace("/", "_"), static.File(path))
- root.putChild(config.TV_RECORD_DIR.replace("/", "_"),
static.File(config.TV_RECORD_DIR))
- root.putChild(config.WEBSERVER_CACHEDIR.replace("/", "_"),
static.File(config.WEBSERVER_CACHEDIR))
root.putChild('vhost', vhost.VHostMonsterResource())
rewriter = rewrite.RewriterResource(root, helpimagesrewrite)
Modified: branches/rel-1/freevo/src/www/htdocs/fileinfo.rpy
==============================================================================
--- branches/rel-1/freevo/src/www/htdocs/fileinfo.rpy (original)
+++ branches/rel-1/freevo/src/www/htdocs/fileinfo.rpy Fri Jan 5 23:29:04 2007
@@ -167,7 +167,11 @@
for i in range(len(self.allowed_dirs)):
val = self.allowed_dirs[i][1]
if dir_str.startswith(val):
- return val.replace("/", "_") + dir_str[len(val):]
+ child_res = val.replace("/", "_")
+ location = dir_str[len(val):]
+ if not location[0] == "/":
+ child_res += "/"
+ return child_res + location
return dir_str
Modified: branches/rel-1/freevo/src/www/htdocs/library.rpy
==============================================================================
--- branches/rel-1/freevo/src/www/htdocs/library.rpy (original)
+++ branches/rel-1/freevo/src/www/htdocs/library.rpy Fri Jan 5 23:29:04 2007
@@ -87,8 +87,11 @@
if dir_str.startswith(val):
child_res = val
break
-
- return child_res.replace("/", "_") + dir_str[len(child_res):]
+ child_res = child_res.replace("/", "_")
+ location = dir_str[len(child_res):]
+ if not location[0] == "/":
+ child_res += "/"
+ return child_res + location
def get_suffixes (self, media):
print 'get_suffixes (self, media=\"%s\")' % (media)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog