[Checkins] SVN: megrok.login/trunk/s cleanups

Jan-Wijbrand Kolman janwijbrand at gmail.com
Thu May 26 05:09:52 EDT 2011


Log message for revision 121809:
  cleanups

Changed:
  U   megrok.login/trunk/setup.py
  U   megrok.login/trunk/src/megrok/login/grokker.py
  U   megrok.login/trunk/src/megrok/login/tests/custompausetup.py
  U   megrok.login/trunk/src/megrok/login/tests/test_login.py

-=-
Modified: megrok.login/trunk/setup.py
===================================================================
--- megrok.login/trunk/setup.py	2011-05-26 06:52:45 UTC (rev 121808)
+++ megrok.login/trunk/setup.py	2011-05-26 09:09:52 UTC (rev 121809)
@@ -5,9 +5,7 @@
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
 tests_require = [
-    'z3c.testsetup',
     'zope.app.wsgi',
-    'zope.app.appsetup',
     'zope.testbrowser',
     'zope.testing',
     ]
@@ -51,8 +49,8 @@
     include_package_data = True,
     zip_safe=False,
     install_requires=[
-        'grok',
-        'martian',
+        'grok >= 1.6',
+        'martian >= 0.14',
         'setuptools',
         'zope.authentication',
         'zope.component',

Modified: megrok.login/trunk/src/megrok/login/grokker.py
===================================================================
--- megrok.login/trunk/src/megrok/login/grokker.py	2011-05-26 06:52:45 UTC (rev 121808)
+++ megrok.login/trunk/src/megrok/login/grokker.py	2011-05-26 09:09:52 UTC (rev 121809)
@@ -6,8 +6,9 @@
 from zope.pluggableauth.plugins.principalfolder import PrincipalFolder
 from zope.pluggableauth.plugins.session import SessionCredentialsPlugin
 from zope.authentication.interfaces import IAuthentication
-from megrok.login.authplugins import (PrincipalRegistryAuthenticator,
-                                      AutoRegisteringPrincipalFolder)
+from grokcore.site.interfaces import IUtilityInstaller
+from megrok.login.authplugins import (
+    PrincipalRegistryAuthenticator, AutoRegisteringPrincipalFolder)
 
 class ApplicationGrokker(martian.ClassGrokker):
     martian.component(grok.Site)
@@ -17,7 +18,7 @@
     martian.directive(megrok.login.strict, default=False)
     martian.directive(megrok.login.autoregister, default=u'')
     martian.directive(megrok.login.setup, default=None)
-    
+
     def execute(self, factory, config, enable, viewname, strict,
                 autoregister, setup, **kw):
         if enable is False:
@@ -32,16 +33,10 @@
         return True
 
 def authenticationSubscriber(site, event):
-    try:
-        # Conditional import. Newer versions of grok do not provide
-        # `setupUtility` any more...
-        from grok.meta import setupUtility
-    except ImportError:
-        from grokcore.site.interfaces import IUtilityInstaller
-        setupUtility = component.getUtility(IUtilityInstaller)
-    setupUtility(site, PluggableAuthentication(), IAuthentication,
-                 setup=setupPAU,
-                 name_in_container='megrok_login_pau')
+    setupUtility = component.getUtility(IUtilityInstaller)
+    setupUtility(
+        site, PluggableAuthentication(), IAuthentication,
+        setup=setupPAU, name_in_container='megrok_login_pau')
 
 def setupPAU(pau):
     """Callback to setup the Pluggable Authentication Utility """
@@ -56,7 +51,7 @@
         result = setup(pau, viewname=viewname, strict=strict,
                        autoregister=autoregister)
         return result
-    
+
     if len(autoregister) > 0 :
         pau['principals'] = AutoRegisteringPrincipalFolder(
             autopermissions = autoregister)

Modified: megrok.login/trunk/src/megrok/login/tests/custompausetup.py
===================================================================
--- megrok.login/trunk/src/megrok/login/tests/custompausetup.py	2011-05-26 06:52:45 UTC (rev 121808)
+++ megrok.login/trunk/src/megrok/login/tests/custompausetup.py	2011-05-26 09:09:52 UTC (rev 121809)
@@ -78,13 +78,10 @@
 """
 import grok
 import megrok.login
-
-from zope.pluggableauth import PluggableAuthentication
 from zope.pluggableauth.plugins.principalfolder import PrincipalFolder
 from zope.pluggableauth.plugins.session import SessionCredentialsPlugin
-from zope.authentication.interfaces import IAuthentication
-from megrok.login.authplugins import (PrincipalRegistryAuthenticator,
-                                      AutoRegisteringPrincipalFolder)
+from megrok.login.authplugins import (
+    PrincipalRegistryAuthenticator, AutoRegisteringPrincipalFolder)
 
 def customPAUSetup(site, pau, viewname=None, strict=None, autoregister=None):
     """Setup our own PAU.

Modified: megrok.login/trunk/src/megrok/login/tests/test_login.py
===================================================================
--- megrok.login/trunk/src/megrok/login/tests/test_login.py	2011-05-26 06:52:45 UTC (rev 121808)
+++ megrok.login/trunk/src/megrok/login/tests/test_login.py	2011-05-26 09:09:52 UTC (rev 121809)
@@ -2,7 +2,7 @@
 import megrok.login
 import re
 import unittest
-from zope.testing import module, renormalizing
+from zope.testing import renormalizing
 from zope.app.wsgi.testlayer import BrowserLayer
 
 _layer = BrowserLayer(megrok.login, zcml_file='ftesting.zcml')
@@ -21,18 +21,6 @@
     doctest.NORMALIZE_WHITESPACE +
     doctest.REPORT_NDIFF)
 
-'''
-def setUp(test):
-    if test.filename.endswith('.txt'):
-        module.setUp(test, '__main__')
-    FunctionalTestSetup().setUp()
-
-def tearDown(test):
-    FunctionalTestSetup().tearDown()
-    if test.filename.endswith('.txt'):
-        module.tearDown(test)
-'''
-
 def test_suite():
     suite = unittest.TestSuite()
     for name in [



More information about the checkins mailing list