[Checkins] SVN: grok/branches/ksmith_mcweekly-layers/src/grok/directive.py add argument checks, clean up white space, remove cruft

Kevin Smith kevin at mcweekly.com
Sun Apr 15 16:14:02 EDT 2007


Log message for revision 74159:
  add argument checks, clean up white space, remove cruft

Changed:
  U   grok/branches/ksmith_mcweekly-layers/src/grok/directive.py

-=-
Modified: grok/branches/ksmith_mcweekly-layers/src/grok/directive.py
===================================================================
--- grok/branches/ksmith_mcweekly-layers/src/grok/directive.py	2007-04-15 19:54:25 UTC (rev 74158)
+++ grok/branches/ksmith_mcweekly-layers/src/grok/directive.py	2007-04-15 20:14:02 UTC (rev 74159)
@@ -199,18 +199,24 @@
                                   "%s." % self.name)
 
 
-
 class DefineSkinDirective(MultipleTimesDirective):
     def check_arguments(self, name, iface):
-        pass
+        if not name:
+            raise GrokImportError("First argument cannot be an empty string"
+                                  "of %s." % self.name)
+        if not IInterface.providedBy(iface):
+            raise GrokImportError("You can only pass an interface as the "
+                                  "second argument of %s." % self.name)
 
     def value_factory(self, *args, **kw):
         return DefineSkinInfo(*args, **kw)
+
         
 class DefineSkinInfo(object):
     def __init__(self, name, iface):
         self.name = name
         self.iface = iface
+
         
 class GlobalUtilityDirective(MultipleTimesDirective):
     def check_arguments(self, factory, provides=None, name=u''):
@@ -296,8 +302,3 @@
 defineskin = DefineSkinDirective('grok.defineskin',
                                  ModuleDirectiveContext())
 
-
-# from zope.component.interface import provideInterface
-# def defineskin(name, iface):
-#     provideInterface(name, iface, IBrowserSkinType)
-



More information about the Checkins mailing list