incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ket...@apache.org
Subject svn commit: r493307 - /incubator/heraldry/libraries/python/openid/trunk/examples/consumer.py
Date Sat, 06 Jan 2007 05:18:38 GMT
Author: keturn
Date: Fri Jan  5 21:18:38 2007
New Revision: 493307

URL: http://svn.apache.org/viewvc?view=rev&rev=493307
Log:
[python-to-heraldry @ Make it possible to force the consumer example to use the python fetcher]

Original author: chowells@janrain.com
Date: 2006-12-04 20:47:04+00:00

Modified:
    incubator/heraldry/libraries/python/openid/trunk/examples/consumer.py

Modified: incubator/heraldry/libraries/python/openid/trunk/examples/consumer.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/examples/consumer.py?view=diff&rev=493307&r1=493306&r2=493307
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/examples/consumer.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/examples/consumer.py Fri Jan  5 21:18:38
2007
@@ -39,7 +39,8 @@
 from openid.oidutil import appendArgs
 from openid.cryptutil import randomString
 from openid.yadis.discover import DiscoveryFailure
-from openid.fetchers import HTTPFetchingError
+from openid.fetchers import (HTTPFetchingError, setDefaultFetcher,
+                             Urllib2Fetcher)
 
 SREG_URI = 'http://openid.net/sreg/1.0'
 
@@ -420,12 +421,15 @@
 </html>
 ''' % (quoteattr(self.buildURL('verify')), quoteattr(form_contents)))
 
-def main(host, port, data_path):
+def main(host, port, data_path, weak_ssl=False):
     # Instantiate OpenID consumer store and OpenID consumer.  If you
     # were connecting to a database, you would create the database
     # connection and instantiate an appropriate store here.
     store = filestore.FileOpenIDStore(data_path)
 
+    if weak_ssl:
+        setDefaultFetcher(Urllib2Fetcher())
+
     addr = (host, port)
     server = OpenIDHTTPServer(store, addr, OpenIDRequestHandler)
 
@@ -437,6 +441,7 @@
     host = 'localhost'
     data_path = 'cstore'
     port = 8001
+    weak_ssl = False
 
     try:
         import optparse
@@ -456,6 +461,9 @@
             '-s', '--host', dest='host', default=host,
             help='Host on which to listen for HTTP requests. '
             'Also used for generating URLs. Defaults to %default.')
+        parser.add_option(
+            '-w', '--weakssl', dest='weakssl', default=False,
+            action='store_true', help='Skip ssl cert verification')
 
         options, args = parser.parse_args()
         if args:
@@ -464,5 +472,6 @@
         host = options.host
         port = options.port
         data_path = options.data_path
+        weak_ssl = options.weakssl
 
-    main(host, port, data_path)
+    main(host, port, data_path, weak_ssl)



Mime
View raw message