Ross Patterson <[EMAIL PROTECTED]> writes:

> zope.app.interface.PersistentInterface gets used properly for
> persistent modules containing classes that subclass
> zope.interface.Interface when those modules are are managed and
> registered through managers and registries from zodbcode.  However,
> similar persistent modules are broken when managed and registered
> through managers and registries from zope.app.module.  Attached is a
> diff against zope.app.module that adds a test demonstrating the
> failure.
>
> I'll create an issue in the collector if I can't fix this, but I hope
> to fix it.
>
> What I'd like to know is why zope.app.module seems to have totally
> independent manager and registry implementaitons from those found in
> zodbcode.  It looks like Fred Drake did a lot of the work on zodbcode
> and Setphan Richter did a lot of the work on zope.app.module, so I was
> hoping to learn something about the rationale from one or both of
> you.  Is there any reason not to realign the implmentations in
> zope.app.module with those in zodbcode?
>
> I realize that most of this work was done long ago, but I appreciate
> any insight.
>
> Ross

Attached is a new verion of the patch against zope.app.module that I
think is a bit clearer.  It demonstrates that the manager from
zodbcode works where the manager from zope.app.module doesn't.

Ross

Index: interfaces.txt
===================================================================
--- interfaces.txt	(revision 0)
+++ interfaces.txt	(revision 0)
@@ -0,0 +1,24 @@
+;-*-Doctest-*-
+=====================
+Persistent Interfaces
+=====================
+
+Verify that persistent interfaces cooperate::
+
+  >>> from zodbcode.module import PersistentModuleRegistry
+  >>> from zodbcode.module import PersistentModuleManager
+  >>> from zope.app.module.manager import ModuleManager
+  >>> p_registry = PersistentModuleRegistry()
+  >>> p_manager = PersistentModuleManager(p_registry)
+  >>> manager = ModuleManager()
+
+  >>> source = """\n
+  ... from zope.interface import Interface
+  ... class IFoo(Interface): pass
+  ... """
+  >>> p_manager.new('foo', source)
+  >>> p_manager._module
+  <PersistentModule foo>
+  >>> manager.source = source
+  >>> manager.getModule()
+  <PersistentModule None>
Index: tests.py
===================================================================
--- tests.py	(revision 72377)
+++ tests.py	(working copy)
@@ -34,7 +34,8 @@
 
 def test_suite():
     return unittest.TestSuite((
-        doctest.DocFileSuite('README.txt', setUp=setUp, tearDown=tearDown),
+        doctest.DocFileSuite('README.txt', 'interfaces.txt',
+                             setUp=setUp, tearDown=tearDown),
         ))
 
 if __name__ == "__main__":
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to