Module: deluge
Branch: master
Commit: 67bcaa267a71ddf798a5dc4b8c6714b97e2dbdaf

Author: Damien Churchill <[email protected]>
Date:   Sat Mar 20 12:01:02 2010 +0000

allow the base path to be specified by a command line switch on deluge-web

---

 deluge/ui/web/server.py |    8 ++++----
 deluge/ui/web/web.py    |    6 ++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py
index f9d5f37..44ea65c 100644
--- a/deluge/ui/web/server.py
+++ b/deluge/ui/web/server.py
@@ -406,9 +406,6 @@ class TopLevel(resource.Resource):
             theme = CONFIG_DEFAULTS.get("theme")
         self.__stylesheets.insert(1, "themes/css/xtheme-%s.css" % theme)
 
-        self.base = component.get("DelugeWeb").config["base"]
-
-
     @property
     def scripts(self):
         return self.__scripts
@@ -480,7 +477,9 @@ class TopLevel(resource.Resource):
 
         template = Template(filename=rpath("index.html"))
         request.setHeader("content-type", "text/html; charset=utf-8")
-        return template.render(scripts=scripts, stylesheets=self.stylesheets, 
debug=debug, base=self.base)
+        base = component.get("DelugeWeb").base
+
+        return template.render(scripts=scripts, stylesheets=self.stylesheets, 
debug=debug, base=base)
 
 class ServerContextFactory:
 
@@ -534,6 +533,7 @@ class DelugeWeb(component.Component):
         self.https = self.config["https"]
         self.pkey = self.config["pkey"]
         self.cert = self.config["cert"]
+        self.base = self.config["base"]
         self.web_api = WebApi()
         self.auth = Auth()
 
diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py
index c4e51b3..a2b5765 100644
--- a/deluge/ui/web/web.py
+++ b/deluge/ui/web/web.py
@@ -53,6 +53,9 @@ class Web(_UI):
         self.__server =  None
         
         group = OptionGroup(self.parser, "Web Options")
+        group.add_option("-b", "--base", dest="base",
+            help="Set the base path that the ui is running on (proxying)",
+            action="store", default=None)
         group.add_option("-f", "--fork", dest="fork",
             help="Fork the web interface process into the background",
             action="store_true", default=False)
@@ -103,6 +106,9 @@ class Web(_UI):
         
         import server
         self.__server = server.DelugeWeb()
+
+        if self.options.base:
+            self.server.base = self.options.base
         
         if self.options.port:
             self.server.port = self.options.port

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to