[Checkins] SVN: z3c.configurator/trunk/src/z3c/configurator/ Raise the correct exception if call is not implemented

Jürgen Kartnaller juergen at kartnaller.at
Tue Feb 6 03:37:43 EST 2007


Log message for revision 72391:
  Raise the correct exception if call is not implemented
  

Changed:
  U   z3c.configurator/trunk/src/z3c/configurator/README.txt
  U   z3c.configurator/trunk/src/z3c/configurator/configurator.py

-=-
Modified: z3c.configurator/trunk/src/z3c/configurator/README.txt
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/README.txt	2007-02-06 06:28:05 UTC (rev 72390)
+++ z3c.configurator/trunk/src/z3c/configurator/README.txt	2007-02-06 08:37:42 UTC (rev 72391)
@@ -180,3 +180,29 @@
 responsibility of the plugin to be aware that it doesn't do things
 twice or delete things.
 
+
+Wrong Implementations
+---------------------
+
+A configurator must provide a __call__ method.
+
+  >>> class CallNotImplemented(configurator.ConfigurationPluginBase):
+  ...     zope.component.adapts(ISomething)
+  >>> zope.component.provideAdapter(CallNotImplemented, name='no call')
+
+  >>> configurator.configure(something, None,  names=['no call'])
+  Traceback (most recent call last):
+  ...
+  NotImplementedError
+
+The same must happen for a schema base configurator.
+
+  >>> class SchemaCallNotImplemented(configurator.SchemaConfigurationPluginBase):
+  ...     zope.component.adapts(ISomething)
+  >>> zope.component.provideAdapter(SchemaCallNotImplemented, name='schema no call')
+
+  >>> configurator.configure(something, None,  names=['schema no call'])
+  Traceback (most recent call last):
+  ...
+  NotImplementedError
+

Modified: z3c.configurator/trunk/src/z3c/configurator/configurator.py
===================================================================
--- z3c.configurator/trunk/src/z3c/configurator/configurator.py	2007-02-06 06:28:05 UTC (rev 72390)
+++ z3c.configurator/trunk/src/z3c/configurator/configurator.py	2007-02-06 08:37:42 UTC (rev 72391)
@@ -87,7 +87,7 @@
         self.context = context
 
     def __call__(self, data):
-        raise NotImplemented
+        raise NotImplementedError
 
 class SchemaConfigurationPluginBase(object):
     zope.interface.implements(interfaces.ISchemaConfigurationPlugin)
@@ -101,4 +101,4 @@
             field.validate(data.get(name))
 
     def __call__(self, data):
-        raise NotImplemented
+        raise NotImplementedError



More information about the Checkins mailing list