[Checkins] SVN: keas.kmi/trunk/src/keas/kmi/ Make sure bin/testclient -g works over HTTPs.

Marius Gedminas marius at pov.lt
Thu Sep 4 17:00:31 EDT 2008


Log message for revision 90842:
  Make sure bin/testclient -g works over HTTPs.
  
  

Changed:
  U   keas.kmi/trunk/src/keas/kmi/facility.py
  U   keas.kmi/trunk/src/keas/kmi/testing.py

-=-
Modified: keas.kmi/trunk/src/keas/kmi/facility.py
===================================================================
--- keas.kmi/trunk/src/keas/kmi/facility.py	2008-09-04 20:59:10 UTC (rev 90841)
+++ keas.kmi/trunk/src/keas/kmi/facility.py	2008-09-04 21:00:30 UTC (rev 90842)
@@ -154,7 +154,7 @@
             self._cache[key][0] + self.timeout > time.time()):
             return self._cache[key][1]
         client = self.clientClass(self.url)
-        client.post('/key', key)
+        client.post('/key', key, headers={'content-type': 'text/plain'})
         encryptionKey = client.contents
         self._cache[key] = (time.time(), encryptionKey)
         return encryptionKey

Modified: keas.kmi/trunk/src/keas/kmi/testing.py
===================================================================
--- keas.kmi/trunk/src/keas/kmi/testing.py	2008-09-04 20:59:10 UTC (rev 90841)
+++ keas.kmi/trunk/src/keas/kmi/testing.py	2008-09-04 21:00:30 UTC (rev 90842)
@@ -43,13 +43,17 @@
     def __init__(self, url):
         self.url = url
 
-    def post(self, url, data=None):
+    def post(self, url, data=None, headers={}):
         io = cStringIO.StringIO(data) if data else None
         request = browser.TestRequest(io)
         request.method = 'POST'
         if url == '/new':
             klass = rest.NewView
         elif url == '/key':
+            if headers.get('content-type') != 'text/plain':
+                # ensure we don't trip on
+                # http://trac.pythonpaste.org/pythonpaste/ticket/294
+                raise ValueError('bad content type')
             klass = rest.KeyView
         else:
             raise ValueError(url)



More information about the Checkins mailing list