[Checkins] SVN: grok/trunk/ Fix imports from zope.app.securitypolicy.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Wed Nov 14 07:56:06 EST 2007


Log message for revision 81830:
  Fix imports from zope.app.securitypolicy.

Changed:
  U   grok/trunk/CHANGES.txt
  U   grok/trunk/src/grok/components.py
  U   grok/trunk/src/grok/configure.zcml
  U   grok/trunk/src/grok/ftesting.zcml
  U   grok/trunk/src/grok/ftests/security/require.py
  U   grok/trunk/src/grok/ftests/security/roles.py
  U   grok/trunk/src/grok/meta.py

-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt	2007-11-14 12:14:27 UTC (rev 81829)
+++ grok/trunk/CHANGES.txt	2007-11-14 12:56:06 UTC (rev 81830)
@@ -7,6 +7,8 @@
 Bug fixes
 ---------
 
+* Fix imports from zope.app.securitypolicy.
+
 * Grok does not raise a GrokError anymore when it finds unassociated
   templates, but will issue a UserWarning.
 

Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py	2007-11-14 12:14:27 UTC (rev 81829)
+++ grok/trunk/src/grok/components.py	2007-11-14 12:56:06 UTC (rev 81830)
@@ -26,7 +26,7 @@
 from zope import interface
 from zope.interface.common import idatetime
 from zope.security.permission import Permission
-from zope.app.securitypolicy.role import Role
+from zope.securitypolicy.role import Role
 from zope.publisher.browser import BrowserPage
 from zope.publisher.interfaces import NotFound
 from zope.publisher.interfaces.browser import (IBrowserPublisher,
@@ -147,9 +147,9 @@
         # This is BBB code for Zope page templates only:
         if not isinstance(self.template, PageTemplate):
             raise AttributeError("View has no item %s" % key)
-        
+
         value = self.template._template.macros[key]
-        # When this deprecation is done with, this whole __getitem__ can 
+        # When this deprecation is done with, this whole __getitem__ can
         # be removed.
         warnings.warn("Calling macros directly on the view is deprecated. "
                       "Please use context/@@viewname/macros/macroname\n"
@@ -157,7 +157,7 @@
                       DeprecationWarning, 1)
         return value
 
-    
+
     def url(self, obj=None, name=None):
         # if the first argument is a string, that's the name. There should
         # be no second argument
@@ -202,7 +202,7 @@
 
 class REST(object):
     interface.implements(interfaces.IREST)
-    
+
     def __init__(self, context, request):
         self.context = context
         self.request = request
@@ -211,16 +211,16 @@
     @property
     def response(self):
         return self.request.response
-    
+
 ##     def GET(self):
 ##         raise GrokMethodNotAllowed(self.context, self.request)
-    
+
 ##     def POST(self):
 ##         raise GrokMethodNotAllowed(self.context, self.request)
-    
+
 ##     def PUT(self):
 ##         raise GrokMethodNotAllowed(self.context, self.request)
-    
+
 ##     def DELETE(self):
 ##         raise GrokMethodNotAllowed(self.context, self.request)
 
@@ -235,7 +235,7 @@
 
 class BaseTemplate(object):
     """Any sort of page template"""
-    
+
     interface.implements(interfaces.ITemplate)
 
     __grok_name__ = ''
@@ -255,10 +255,10 @@
 
 class GrokTemplate(BaseTemplate):
     """A slightly more advanced page template
-    
+
     This provides most of what a page template needs and is a good base for
     writing your own page template"""
-    
+
     def __init__(self, string=None, filename=None, _prefix=None):
 
         # __grok_module__ is needed to make defined_locally() return True for
@@ -267,10 +267,10 @@
         # when GrokTemplate is subclassed. You can not do a super().__init__
         # for example.
         self.__grok_module__ = martian.util.caller_module()
-        
+
         if not (string is None) ^ (filename is None):
             raise AssertionError("You must pass in template or filename, but not both.")
-        
+
         if string:
             self.setFromString(string)
         else:
@@ -282,7 +282,7 @@
     def __repr__(self):
         return '<%s template in %s>' % (self.__grok_name__,
                                         self.__grok_location__)
-    
+
     def _annotateGrokInfo(self, name, location):
         self.__grok_name__ = name
         self.__grok_location__ = location
@@ -297,9 +297,9 @@
         namespace['context'] = view.context
         # XXX need to check whether we really want to put None here if missing
         namespace['static'] = view.static
-        
+
         return namespace
-    
+
     def getNamespace(self, view):
         namespace = self.namespace(view)
         namespace.update(view.namespace())
@@ -312,7 +312,7 @@
     pass
 
 class PageTemplate(GrokTemplate):
-    
+
     def setFromString(self, string):
         zpt = TrustedPageTemplate()
         if martian.util.not_unicode_or_ascii(string):
@@ -332,7 +332,7 @@
         template = self._template
         namespace.update(template.pt_getContext())
         return template.pt_render(namespace)
-    
+
 class PageTemplateFile(PageTemplate):
     # For BBB
     def __init__(self, filename, _prefix=None):
@@ -341,7 +341,7 @@
             module = sys.modules[self.__grok_module__]
             _prefix = os.path.dirname(module.__file__)
         self.setFromFilename(filename, _prefix)
-    
+
 class DirectoryResource(directoryresource.DirectoryResource):
     # We subclass this, because we want to override the default factories for
     # the resources so that .pt and .html do not get created as page

Modified: grok/trunk/src/grok/configure.zcml
===================================================================
--- grok/trunk/src/grok/configure.zcml	2007-11-14 12:14:27 UTC (rev 81829)
+++ grok/trunk/src/grok/configure.zcml	2007-11-14 12:56:06 UTC (rev 81830)
@@ -1,4 +1,4 @@
-<configure    
+<configure
     xmlns="http://namespaces.zope.org/zope"
     xmlns:browser="http://namespaces.zope.org/browser"
     xmlns:grok="http://namespaces.zope.org/grok">
@@ -27,7 +27,7 @@
   <include package="zope.app.session" />
 
   <securityPolicy
-      component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+      component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
 
   <adapter factory=".components.ModelTraverser" />
   <adapter factory=".components.ContainerTraverser" />
@@ -83,7 +83,7 @@
 
   <!-- ZPT support -->
   <grok:grok package=".templatereg" />
-  
+
   <!-- The admin interface -->
   <grok:grok package=".admin" />
 

Modified: grok/trunk/src/grok/ftesting.zcml
===================================================================
--- grok/trunk/src/grok/ftesting.zcml	2007-11-14 12:14:27 UTC (rev 81829)
+++ grok/trunk/src/grok/ftesting.zcml	2007-11-14 12:56:06 UTC (rev 81830)
@@ -9,7 +9,7 @@
   <grok:grok package="grok.ftests" />
 
   <securityPolicy
-      component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+      component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
       />
 
   <unauthenticatedPrincipal

Modified: grok/trunk/src/grok/ftests/security/require.py
===================================================================
--- grok/trunk/src/grok/ftests/security/require.py	2007-11-14 12:14:27 UTC (rev 81829)
+++ grok/trunk/src/grok/ftests/security/require.py	2007-11-14 12:56:06 UTC (rev 81830)
@@ -10,7 +10,7 @@
 
 When we log in (e.g. as a manager), we can access the view just fine:
 
-  >>> from zope.app.securitypolicy.rolepermission import rolePermissionManager
+  >>> from zope.securitypolicy.rolepermission import rolePermissionManager
   >>> rolePermissionManager.grantPermissionToRole('grok.ViewPainting',
   ...                                             'zope.Manager')
   >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')

Modified: grok/trunk/src/grok/ftests/security/roles.py
===================================================================
--- grok/trunk/src/grok/ftests/security/roles.py	2007-11-14 12:14:27 UTC (rev 81829)
+++ grok/trunk/src/grok/ftests/security/roles.py	2007-11-14 12:56:06 UTC (rev 81830)
@@ -21,7 +21,7 @@
 don't have to modify the global setup).  Then we can access the views
 just fine:
 
-  >>> from zope.app.securitypolicy.interfaces import IPrincipalRoleManager
+  >>> from zope.securitypolicy.interfaces import IPrincipalRoleManager
   >>> root = getRootFolder()
   >>> IPrincipalRoleManager(root).assignRoleToPrincipal(
   ...    'grok.PaintingOwner', 'zope.anybody')

Modified: grok/trunk/src/grok/meta.py
===================================================================
--- grok/trunk/src/grok/meta.py	2007-11-14 12:14:27 UTC (rev 81829)
+++ grok/trunk/src/grok/meta.py	2007-11-14 12:56:06 UTC (rev 81830)
@@ -23,8 +23,8 @@
                                                IBrowserSkinType)
 from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
 from zope.security.interfaces import IPermission
-from zope.app.securitypolicy.interfaces import IRole
-from zope.app.securitypolicy.rolepermission import rolePermissionManager
+from zope.securitypolicy.interfaces import IRole
+from zope.securitypolicy.rolepermission import rolePermissionManager
 
 from zope.annotation.interfaces import IAnnotations
 
@@ -74,7 +74,7 @@
             util.check_implements_one(factory)
         name = util.class_annotation(factory, 'grok.name', '')
 
-        config.action( 
+        config.action(
             discriminator=('adapter', adapter_context, provides, name),
             callable=component.provideAdapter,
             args=(factory, (adapter_context,), provides, name),
@@ -103,7 +103,7 @@
 class GlobalUtilityGrokker(martian.ClassGrokker):
     component_class = grok.GlobalUtility
 
-    # This needs to happen before the FilesystemPageTemplateGrokker grokker 
+    # This needs to happen before the FilesystemPageTemplateGrokker grokker
     # happens, since it relies on the ITemplateFileFactories being grokked.
     priority = 1100
 
@@ -170,7 +170,7 @@
 
 class RESTGrokker(martian.ClassGrokker):
     component_class = grok.REST
-    
+
     def grok(self, name, factory, module_info, config, **kw):
         context = module_info.getAnnotation('grok.context', None)
         view_context = util.determine_class_context(factory, context)
@@ -184,7 +184,7 @@
         view_layer = determine_class_directive('grok.layer', factory,
                                                module_info,
                                                default=grok.IRESTLayer)
-        
+
         for method in methods:
             name = method.__name__
             if name.startswith('__'):
@@ -215,8 +215,8 @@
                 args=(factory, method_view, permission),
                 )
         return True
-    
-    
+
+
 class ViewGrokker(martian.ClassGrokker):
     component_class = grok.View
 
@@ -341,7 +341,7 @@
             discriminator=('adapter', adapts, IBrowserPublisher, ''),
             callable=component.provideAdapter,
             args=(factory, adapts, IBrowserPublisher),
-            )            
+            )
         return True
 
 
@@ -377,8 +377,8 @@
             args=(name, module_info.dotted_name)
         )
         return True
-        
 
+
 class FilesystemPageTemplateGrokker(martian.GlobalGrokker):
     # do this early on, but after ModulePageTemplateGrokker, as
     # findFilesystem depends on module-level templates to be
@@ -404,7 +404,7 @@
         templates = module_info.getAnnotation('grok.templates', None)
         if templates is None:
             return False
-        
+
         config.action(
             discriminator=None,
             callable=templates.checkUnassociated,
@@ -419,7 +419,7 @@
         subscribers = module_info.getAnnotation('grok.subscribers', [])
 
         for factory, subscribed in subscribers:
-            config.action( 
+            config.action(
                 discriminator=None,
                 callable=component.provideHandler,
                 args=(factory, subscribed),
@@ -446,8 +446,8 @@
                 # module context to be the thing adapted.
                 util.check_context(module_info.getModule(), context)
                 interfaces = (context, )
-            
-            config.action( 
+
+            config.action(
                 discriminator=('adapter', interfaces, function.__implemented__),
                 callable=component.provideAdapter,
                 args=(function, interfaces, function.__implemented__),
@@ -574,7 +574,7 @@
         factory.__grok_utilities_to_install__ = overridden_infos
         adapts = (factory, grok.IObjectAddedEvent)
 
-        config.action( 
+        config.action(
             discriminator=None,
             callable=component.provideHandler,
             args=(localUtilityRegistrationSubscriber, adapts),
@@ -654,7 +654,7 @@
             unicode(util.class_annotation(factory, 'grok.title', id)),
             unicode(util.class_annotation(factory, 'grok.description', '')))
 
-        config.action( 
+        config.action(
             discriminator=('utility', IPermission, name),
             callable=component.provideUtility,
             args=(permission, IPermission, id),
@@ -680,7 +680,7 @@
             unicode(util.class_annotation(factory, 'grok.title', id)),
             unicode(util.class_annotation(factory, 'grok.description', '')))
 
-        config.action( 
+        config.action(
             discriminator=('utility', IRole, name),
             callable=component.provideUtility,
             args=(role, IRole, id),
@@ -774,7 +774,7 @@
         subscriber = IndexesSetupSubscriber(catalog_name, indexes,
                                             context, module_info)
         subscribed = (site, grok.IObjectAddedEvent)
-        config.action( 
+        config.action(
             discriminator=None,
             callable=component.provideHandler,
             args=(subscriber, subscribed),



More information about the Checkins mailing list