[Checkins] SVN: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/ If applyTransform gets passed a tuple, return a tuple.
Maurits van Rees
cvs-admin at zope.org
Mon Jan 21 13:12:05 UTC 2013
Log message for revision 129068:
If applyTransform gets passed a tuple, return a tuple.
Changed:
U Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py
U Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/tests/test_PluggableAuthService.py
-=-
Modified: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py
===================================================================
--- Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py 2013-01-21 13:08:33 UTC (rev 129067)
+++ Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/PluggableAuthService.py 2013-01-21 13:12:05 UTC (rev 129068)
@@ -1073,10 +1073,8 @@
Possibly transform the login, for example by making it lower
case.
- value must be a string (or unicode).
-
- Note: the value may be a sequence (list, tuple) so we may
- need to iterate over it. We return a list then.
+ value must be a string (or unicode) or it may be a sequence
+ (list, tuple), in which case we need to iterate over it.
"""
if not value:
return value
@@ -1088,6 +1086,8 @@
result = []
for v in value:
result.append(transform(v))
+ if isinstance(value, tuple):
+ return tuple(result)
return result
security.declarePrivate( '_get_login_transform_method' )
Modified: Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/tests/test_PluggableAuthService.py
===================================================================
--- Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/tests/test_PluggableAuthService.py 2013-01-21 13:08:33 UTC (rev 129067)
+++ Products.PluggableAuthService/branches/maurits-login-transform/Products/PluggableAuthService/tests/test_PluggableAuthService.py 2013-01-21 13:12:05 UTC (rev 129068)
@@ -2773,7 +2773,7 @@
self.assertEqual(zcuf.applyTransform(None), None)
self.assertEqual(zcuf.applyTransform([' User ']), ['user'])
self.assertEqual(zcuf.applyTransform(('User', ' joe ', 'Diana')),
- ['user', 'joe', 'diana'])
+ ('user', 'joe', 'diana'))
self.assertRaises(TypeError, zcuf.applyTransform, 123)
zcuf.login_transform = 'upper'
self.assertEqual(zcuf.applyTransform(' User '), 'USER')
More information about the checkins
mailing list