incubator-heraldry-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?view=rev&rev=493306
Log:
[python-to-heraldry @ examples/consumer: add an /affiliate page to help exercise myopenid's
affiliate code]

Original author: Kevin Turner <kevin@janrain.com>
Date: 2006-11-27 23:40:36+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=493306&r1=493305&r2=493306
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/examples/consumer.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/examples/consumer.py Fri Jan  5 21:18:33
2007
@@ -43,6 +43,10 @@
 
 SREG_URI = 'http://openid.net/sreg/1.0'
 
+# Used with an OpenID provider affiliate program.
+OPENID_PROVIDER_NAME = 'MyOpenID'
+OPENID_PROVIDER_URL ='https://www.myopenid.com/affiliate_signup?affiliate_id=39'
+
 
 class OpenIDHTTPServer(HTTPServer):
     """http server that contains a reference to an OpenID consumer and
@@ -132,6 +136,8 @@
                 self.doVerify()
             elif path == '/process':
                 self.doProcess()
+            elif path == '/affiliate':
+                self.doAffiliate()
             else:
                 self.notFound()
 
@@ -245,6 +251,19 @@
             message = 'Verification failed.'
 
         self.render(message, css_class, info.identity_url, sreg_data=sreg)
+
+    def doAffiliate(self):
+        """Direct the user sign up with an affiliate OpenID provider."""
+        sreg_required = ['nickname']
+        sreg_optional = ['fullname', 'email']
+        href = '%s&openid.sreg.required=%s&openid.sreg.optional=%s' % (
+            OPENID_PROVIDER_URL,
+            ','.join(sreg_required),
+            ','.join(sreg_optional),
+            )
+        message = """Get an OpenID at <a href=%s>%s</a>""" % (
+            quoteattr(href), OPENID_PROVIDER_NAME)
+        self.render(message)
 
     def renderSREG(self, sreg_data):
         if not sreg_data:



Mime
View raw message