incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ket...@apache.org
Subject svn commit: r493313 - in /incubator/heraldry/libraries/python/openid/trunk/openid: consumer/consumer.py server/server.py test/test_consumer.py test/test_server.py
Date Sat, 06 Jan 2007 05:19:12 GMT
Author: keturn
Date: Fri Jan  5 21:19:11 2007
New Revision: 493313

URL: http://svn.apache.org/viewvc?view=rev&rev=493313
Log:
[python-to-heraldry @ Send contact and reference in error messages regardless of protocol
version]

Original author: cygnus@janrain.com
Date: 2006-12-14 19:46:48+00:00

Modified:
    incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py
    incubator/heraldry/libraries/python/openid/trunk/openid/server/server.py
    incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py
    incubator/heraldry/libraries/python/openid/trunk/openid/test/test_server.py

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py?view=diff&rev=493313&r1=493312&r2=493313
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py Fri Jan 
5 21:19:11 2007
@@ -445,13 +445,8 @@
             return CancelResponse(endpoint)
         elif mode == 'error':
             error = message.getArg(OPENID_NS, 'error')
-
-            contact = reference = None
-            # Only look at extra error response values if using OpenID
-            # 2.
-            if message.getOpenIDNamespace() == OPENID2_NS:
-                contact = message.getArg(OPENID_NS, 'contact')
-                reference = message.getArg(OPENID_NS, 'reference')
+            contact = message.getArg(OPENID_NS, 'contact')
+            reference = message.getArg(OPENID_NS, 'reference')
 
             return FailureResponse(endpoint, error, contact=contact,
                                    reference=reference)

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/server/server.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/server/server.py?view=diff&rev=493313&r1=493312&r2=493313
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/server/server.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/server/server.py Fri Jan  5 21:19:11
2007
@@ -1356,13 +1356,11 @@
         reply.setArg(OPENID_NS, 'mode', 'error')
         reply.setArg(OPENID_NS, 'error', str(self))
 
-        # Send contact and reference if using OpenID 2
-        if namespace == OPENID2_NS:
-            if self.contact is not None:
-                reply.setArg(OPENID_NS, 'contact', str(self.contact))
+        if self.contact is not None:
+            reply.setArg(OPENID_NS, 'contact', str(self.contact))
 
-            if self.reference is not None:
-                reply.setArg(OPENID_NS, 'reference', str(self.reference))
+        if self.reference is not None:
+            reply.setArg(OPENID_NS, 'reference', str(self.reference))
 
         return reply
 

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py?view=diff&rev=493313&r1=493312&r2=493313
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py Fri Jan
 5 21:19:11 2007
@@ -349,14 +349,15 @@
 
     def test_errorWithNoOptionalKeys(self):
         msg = 'an error message'
+        contact = 'some contact info here'
         message = Message.fromPostArgs({'openid.mode': 'error',
-                 'openid.error': msg, 'openid.reference': 'a ref',
-                 'openid.contact': 'some contact info here',
+                 'openid.error': msg,
+                 'openid.contact': contact,
                  })
         r = self.consumer.complete(message, self.endpoint)
         self.failUnlessEqual(r.status, FAILURE)
         self.failUnless(r.identity_url == self.endpoint.identity_url)
-        self.failUnless(r.contact is None)
+        self.failUnless(r.contact == contact)
         self.failUnless(r.reference is None)
         self.failUnlessEqual(r.message, msg)
 

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/test/test_server.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/test/test_server.py?view=diff&rev=493313&r1=493312&r2=493313
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/test/test_server.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/test/test_server.py Fri Jan  5
21:19:11 2007
@@ -895,22 +895,21 @@
         openid2_args = dict(openid1_args)
         openid2_args.update({'openid.ns': OPENID2_NS})
 
+        # Check presence of optional fields in both protocol versions
+
         openid1_msg = Message.fromPostArgs(openid1_args)
         p = server.ProtocolError(openid1_msg, error,
                                  contact=contact, reference=reference)
         reply = p.toMessage()
 
-        # Should be None if the message is an openid1 message
-        self.failUnlessEqual(reply.getArg(OPENID_NS, 'reference'), None)
-        self.failUnlessEqual(reply.getArg(OPENID_NS, 'contact'), None)
+        self.failUnlessEqual(reply.getArg(OPENID_NS, 'reference'), reference)
+        self.failUnlessEqual(reply.getArg(OPENID_NS, 'contact'), contact)
 
         openid2_msg = Message.fromPostArgs(openid2_args)
         p = server.ProtocolError(openid2_msg, error,
                                  contact=contact, reference=reference)
         reply = p.toMessage()
 
-        # Should be present (in this case) if the message is an
-        # openid2 message
         self.failUnlessEqual(reply.getArg(OPENID_NS, 'reference'), reference)
         self.failUnlessEqual(reply.getArg(OPENID_NS, 'contact'), contact)
 



Mime
View raw message