[Inteproxy-commits] r256 - in trunk: . inteproxy

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 21 16:14:13 CEST 2010


Author: iweinzierl
Date: 2010-05-21 16:14:11 +0200 (Fri, 21 May 2010)
New Revision: 256

Modified:
   trunk/ChangeLog
   trunk/inteproxy.cfg
   trunk/inteproxy/config.py
   trunk/inteproxy/main.py
   trunk/inteproxy/proxycore.py
Log:
Added an option to show or suppress a popup that shows fees and access constraints in the case of a GetCapabilities request.

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-05-21 13:59:24 UTC (rev 255)
+++ trunk/ChangeLog	2010-05-21 14:14:11 UTC (rev 256)
@@ -1,11 +1,27 @@
 2010-05-20  Ingo Weinzierl <ingo.weinzierl at intevation.de>
 
+	* inteproxy.cfg: Added a 'show_terms_dialog' option to suppress an
+	  upcoming popup that contains information about fees and access
+	  constraints. Possible values for this option are "true", "yes" and "1"
+	  to show the popup - "false", "no" and "0" to suppress the popup.
+
+	* inteproxy/config.py: Added the 'show_terms_dialog' option and
+	  implemented a function to convert strings into boolean.
+
+	* inteproxy/main.py: Instantiate the inteproxy server with the option to
+	  suppress the popup dialog showing fees and access constraints.
+
+	* inteproxy/proxycore.py: Show fees and access constraints only, if the
+	  option 'show_terms_dialog' is True - which is the default.
+
+2010-05-20  Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
 	* inteproxy/feesdialog.py: Improved the GetCapabilites URL checking. The
 	  parameters of a WMS request might be case insensitive according to the
 	  WMS spec. A GetCapabilities request without uppercase 'REQUEST' will
 	  now be detected as GetCapabilites request as well.
-	  (see issue1217 at http://wald.intevation.org/projects/inteproxy for the
-	  bug report)
+	  (see issue1217 at http://wald.intevation.org/projects/inteproxy for
+	  the bug report)
 
 2010-05-11  Bjoern Schilberg <bjoern.schilberg at intevation.de>
 

Modified: trunk/inteproxy/config.py
===================================================================
--- trunk/inteproxy/config.py	2010-05-21 13:59:24 UTC (rev 255)
+++ trunk/inteproxy/config.py	2010-05-21 14:14:11 UTC (rev 256)
@@ -94,9 +94,19 @@
                          password=password)
 
 
+def convert_bool(s):
+    s = s.lower()
+    if s in ["yes", "true", "1"]:
+        return True
+    if s in ["no", "false", "0"]:
+        return False
+    raise ValueError("Config option has wrong format: %r" % s)
 
+
+
 inteproxy_desc = [Option("http_proxy", default=None),
-                  Option("https_proxy", default=None)]
+                  Option("https_proxy", default=None),
+                  Option("show_terms_dialog",converter=convert_bool,default=1)]
 
 proxy_desc = [Option("host"),
               Option("port", default=80, converter=int),

Modified: trunk/inteproxy/main.py
===================================================================
--- trunk/inteproxy/main.py	2010-05-21 13:59:24 UTC (rev 255)
+++ trunk/inteproxy/main.py	2010-05-21 14:14:11 UTC (rev 256)
@@ -189,7 +189,8 @@
                         handle_proxy_config(config, "http_proxy"),
                         handle_proxy_config(config, "https_proxy"),
                         transcoder_map=transcoder_map,
-                        rewrite_urls=opts.rewrite_urls)
+                        rewrite_urls=opts.rewrite_urls,
+                        show_terms_dialog=config.show_terms_dialog)
 
     # import the gtkapp here instead of at top-level to avoid loading
     # the gtk module.  The gtk module requires an Xserver connection

Modified: trunk/inteproxy/proxycore.py
===================================================================
--- trunk/inteproxy/proxycore.py	2010-05-21 13:59:24 UTC (rev 255)
+++ trunk/inteproxy/proxycore.py	2010-05-21 14:14:11 UTC (rev 256)
@@ -95,7 +95,8 @@
 
         if response is not None:
             # check for fees and access constraints and run a dialog
-            handle_fees_and_access_constraints(remote_url, response)
+            if self.server.show_terms_dialog:
+                handle_fees_and_access_constraints(remote_url, response)
             self.rewrite_urls(response)
             self.handle_response(response)
 
@@ -338,12 +339,13 @@
 
     def __init__(self, server_address, RequestHandlerClass, num_workers,
                  http_proxy, https_proxy, transcoder_map,
-                 rewrite_urls=False):
+                 rewrite_urls=False, show_terms_dialog=True):
         HTTPServer.__init__(self, server_address, RequestHandlerClass)
         self.http_proxy = http_proxy
         self.https_proxy = https_proxy
         self.transcoder_map = transcoder_map
         self.rewrite_urls = rewrite_urls
+        self.show_terms_dialog = show_terms_dialog
         self.thread_pool = ThreadPool(num_workers, lambda f: f())
         sys.stderr.write("[%s] starting %d worker threads\n" \
                          % (log_date_time_string(), num_workers))

Modified: trunk/inteproxy.cfg
===================================================================
--- trunk/inteproxy.cfg	2010-05-21 13:59:24 UTC (rev 255)
+++ trunk/inteproxy.cfg	2010-05-21 14:14:11 UTC (rev 256)
@@ -26,7 +26,14 @@
 # [inteproxy]
 # https_proxy=http_proxy_authentification
 # http_proxy=http_proxy_authentification
-# 
+
+# Uncomment the following line to suppress an upcoming popup that shows fees and
+# access constraints. Allowed values for show_terms_dialog option are "false",
+# "no" and "0" to suppress the popup, "true", "yes" and "1" to show the popup.
+# The default is "true".
+#
+# show_terms_dialog= Otto
+
 # [http_proxy_authentification]
 # host=upstream.proxy.url.com
 # port=8080



More information about the Inteproxy-commits mailing list