[Checkins] SVN: five.grok/trunk/s Remove [role] for grokcore.security. Review the conditional import code.

Sylvain Viollow cvs-admin at zope.org
Wed May 2 09:37:01 UTC 2012


Log message for revision 125587:
  Remove [role] for grokcore.security. Review the conditional import code.
  

Changed:
  U   five.grok/trunk/setup.py
  U   five.grok/trunk/src/five/grok/interfaces.py

-=-
Modified: five.grok/trunk/setup.py
===================================================================
--- five.grok/trunk/setup.py	2012-05-02 09:35:58 UTC (rev 125586)
+++ five.grok/trunk/setup.py	2012-05-02 09:36:57 UTC (rev 125587)
@@ -41,7 +41,7 @@
         'five.localsitemanager > 2.0dev',
         'grokcore.annotation',
         'grokcore.component >= 2.5',
-        'grokcore.security [role] >= 1.6.1',
+        'grokcore.security >= 1.6.1',
         'grokcore.site',
         'grokcore.view >= 1.12.1',
         'grokcore.viewlet >= 1.3',

Modified: five.grok/trunk/src/five/grok/interfaces.py
===================================================================
--- five.grok/trunk/src/five/grok/interfaces.py	2012-05-02 09:35:58 UTC (rev 125586)
+++ five.grok/trunk/src/five/grok/interfaces.py	2012-05-02 09:36:57 UTC (rev 125587)
@@ -19,19 +19,20 @@
 import grokcore.view.interfaces
 import grokcore.viewlet.interfaces
 
-try:
-    from grokcore.formlib.interfaces import IGrokcoreFormlibAPI
-
-    HAVE_FORMLIB = True
-except ImportError:
+def api(name):
+    from zope.dottedname.resolve import resolve
     from zope.interface import Interface
 
-    class IGrokcoreFormlibAPI(Interface):
-        """Empty FormlibAPI
-        """
-    HAVE_FORMLIB = False
+    try:
+        return True, resolve(name)
+    except ImportError:
+        return False, Interface
 
 
+HAVE_FORMLIB, IGrokcoreFormlibAPI = api(
+    'grokcore.formlib.interfaces.IGrokcoreFormlibAPI')
+
+
 class IFiveGrokView(grokcore.view.interfaces.IGrokView):
     """A five.grok view is a specific implementation of a
     grokcore.view.View.



More information about the checkins mailing list