[Inteproxy-commits] r6 - trunk

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 13 15:25:41 CET 2006


Author: jan
Date: 2006-11-13 15:25:41 +0100 (Mon, 13 Nov 2006)
New Revision: 6

Modified:
   trunk/ChangeLog
   trunk/InteProxy.py
Log:
* InteProxy.py (pw_cache): Added global password Cache.
  (InteProxyHTTPRequestHandler.convert_url): Added use of password cache.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-11-01 11:21:12 UTC (rev 5)
+++ trunk/ChangeLog	2006-11-13 14:25:41 UTC (rev 6)
@@ -1,3 +1,8 @@
+2006-11-13  Jan-Oliver Wagner  <jan-oliver.wagner at intevation.de>
+
+	* InteProxy.py (pw_cache): Added global password Cache.
+	(InteProxyHTTPRequestHandler.convert_url): Added use of password cache.
+
 2006-11-01  Jan-Oliver Wagner  <jan-oliver.wagner at intevation.de>
 
 	* doc/InteProxy-de.odt: New. German user documentation for InteProxy.

Modified: trunk/InteProxy.py
===================================================================
--- trunk/InteProxy.py	2006-11-01 11:21:12 UTC (rev 5)
+++ trunk/InteProxy.py	2006-11-13 14:25:41 UTC (rev 6)
@@ -51,6 +51,9 @@
 # thread.
 the_queue = Queue.Queue(0)
 
+# password cache
+pw_cache = {}
+
 def worker_thread():
     """The worker thread
 
@@ -210,10 +213,14 @@
         # Eventually this should be moved to a method of its own
         # and anyway this is just a dirty solution since passwords
         # are not really managed.
+        if pw_cache.has_key(path):
+            user, password = pw_cache[path]
+        else:
+            title = "Username for %s: " % path
+            user, password = getpassword(title)
         # TODO: Building the query this way is not safe.
-        title = "Username for %s: " % path
-        user, password = getpassword(title)
         query += "&user=%s&password=%s" % (user, password)
+        pw_cache[path] = (user, password)
 
         # both scheme and netloc must be empty strings because the url
         # we work with is the url on the first line of a HTTP request



More information about the Inteproxy-commits mailing list