[Checkins] SVN: grok/branches/jw-philipp-using-ndir-directives/src/grok/ Get more tests to pass as we use the new-style directives. Mostly cosmetics.

Philipp von Weitershausen philikon at philikon.de
Sat May 3 09:39:57 EDT 2008


Log message for revision 86210:
  Get more tests to pass as we use the new-style directives. Mostly cosmetics.

Changed:
  U   grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py
  U   grok/branches/jw-philipp-using-ndir-directives/src/grok/meta.py
  U   grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/directive/multipletimes.py
  U   grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/json/nocontext.py
  U   grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/security/not_a_permissionclass.py
  U   grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/zcml/directiveimporterror.py

-=-
Modified: grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py
===================================================================
--- grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py	2008-05-03 13:34:48 UTC (rev 86209)
+++ grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py	2008-05-03 13:39:57 UTC (rev 86210)
@@ -85,7 +85,7 @@
         if util.not_unicode_or_ascii(value):
             raise GrokImportError(
                 "You can only pass unicode, ASCII, or a subclass "
-                "of grok.Permission %s." % self.name)
+                "of grok.Permission to the '%s' directive." % self.name)
 
     def factory(self, value):
         if util.check_subclass(value, components.Permission):

Modified: grok/branches/jw-philipp-using-ndir-directives/src/grok/meta.py
===================================================================
--- grok/branches/jw-philipp-using-ndir-directives/src/grok/meta.py	2008-05-03 13:34:48 UTC (rev 86209)
+++ grok/branches/jw-philipp-using-ndir-directives/src/grok/meta.py	2008-05-03 13:39:57 UTC (rev 86210)
@@ -565,8 +565,8 @@
     priority = 1500
 
     def grok(self, name, factory, module_info, config, **kw):
-        id = grok.name.get(factory, None)
-        if id is None:
+        id = grok.name.get(factory)
+        if not id:
             raise GrokError(
                 "A permission needs to have a dotted name for its id. Use "
                 "grok.name to specify one.", factory)
@@ -592,7 +592,7 @@
 
     def grok(self, name, factory, module_info, config, **kw):
         id = grok.name.get(factory, None)
-        if id is None:
+        if not id:
             raise GrokError(
                 "A role needs to have a dotted name for its id. Use "
                 "grok.name to specify one.", factory)

Modified: grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/directive/multipletimes.py
===================================================================
--- grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/directive/multipletimes.py	2008-05-03 13:34:48 UTC (rev 86209)
+++ grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/directive/multipletimes.py	2008-05-03 13:39:57 UTC (rev 86210)
@@ -2,10 +2,8 @@
 Since grok.global_utility is a MultipleTimesDirective, there is a list of
 GlobalUtilityInfo objects annotated on the module.
 
-  >>> from martian import scan
   >>> from grok.tests.directive import multipletimes
-  >>> module_info = scan.module_info_from_module(multipletimes)
-  >>> guis = module_info.getAnnotation('grok.global_utility', None)
+  >>> guis = grok.global_utility.get(multipletimes)
   >>> guis
   [<grokcore.component.directive.GlobalUtilityInfo object at 0x...>,
    <grokcore.component.directive.GlobalUtilityInfo object at 0x...>]

Modified: grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/json/nocontext.py
===================================================================
--- grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/json/nocontext.py	2008-05-03 13:34:48 UTC (rev 86209)
+++ grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/json/nocontext.py	2008-05-03 13:39:57 UTC (rev 86210)
@@ -7,7 +7,8 @@
   Traceback (most recent call last):
     ...
   GrokError: No module-level context for
-  <class 'grok.tests.json.nocontext.TestJSON'>, please use grok.context.
+  <class 'grok.tests.json.nocontext.TestJSON'>, please use the
+  'context' directive.
 
 """
 import grok

Modified: grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/security/not_a_permissionclass.py
===================================================================
--- grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/security/not_a_permissionclass.py	2008-05-03 13:34:48 UTC (rev 86209)
+++ grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/security/not_a_permissionclass.py	2008-05-03 13:39:57 UTC (rev 86210)
@@ -15,7 +15,7 @@
   Traceback (most recent call last):
   ...
   GrokImportError: You can only pass unicode, ASCII, or a subclass of
-  grok.Permission grok.require.
+  grok.Permission to the 'require' directive.
 
 """
 

Modified: grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/zcml/directiveimporterror.py
===================================================================
--- grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/zcml/directiveimporterror.py	2008-05-03 13:34:48 UTC (rev 86209)
+++ grok/branches/jw-philipp-using-ndir-directives/src/grok/tests/zcml/directiveimporterror.py	2008-05-03 13:39:57 UTC (rev 86210)
@@ -15,5 +15,5 @@
   Traceback (most recent call last):
     ...
   ZopeXMLConfigurationError: File "...", line ...
-  GrokImportError: grok.template can only be used on class level.
+  GrokImportError: The 'template' directive can only be used on class level.
 """



More information about the Checkins mailing list