Log message for revision 65935:
  Now applying monkey patches to make Zope2 work with python packages that 
don't have to live in Products/
  

Changed:
  _U  Products.Five/branches/1.4/
  U   Products.Five/branches/1.4/pythonproducts.py
  U   Products.Five/branches/1.4/tests/test_pythonproducts.py
  A   Products.Five/branches/1.4/tests/testing/pythonproduct2/Extensions/
  A   
Products.Five/branches/1.4/tests/testing/pythonproduct2/Extensions/__init__.py
  A   
Products.Five/branches/1.4/tests/testing/pythonproduct2/Extensions/somemodule.py

-=-

Property changes on: Products.Five/branches/1.4
___________________________________________________________________
Name: svk:merge
   - 98c0701e-2f07-0410-a1a0-c1bc72243522:/local/Products.Five/branches/1.4:8749
   + 98c0701e-2f07-0410-a1a0-c1bc72243522:/local/Products.Five/branches/1.4:8750

Modified: Products.Five/branches/1.4/pythonproducts.py
===================================================================
--- Products.Five/branches/1.4/pythonproducts.py        2006-03-12 23:20:01 UTC 
(rev 65934)
+++ Products.Five/branches/1.4/pythonproducts.py        2006-03-12 23:20:47 UTC 
(rev 65935)
@@ -39,7 +39,7 @@
         _zope_app = appOrContext._ProductContext__app
     
     global _zope_app
-    #applyPatches(_zope_app)
+    applyPatches(_zope_app)
 
 
 def applyPatches(app):
@@ -135,6 +135,7 @@
                 m = __import__(toplevel)
         
                 d = os.path.join(m.__path__[0], prefix, realName)
+                
                 for s in suffixes:
                     if s: s="%s.%s" % (d, s)
                     else: s=d

Modified: Products.Five/branches/1.4/tests/test_pythonproducts.py
===================================================================
--- Products.Five/branches/1.4/tests/test_pythonproducts.py     2006-03-12 
23:20:01 UTC (rev 65934)
+++ Products.Five/branches/1.4/tests/test_pythonproducts.py     2006-03-12 
23:20:47 UTC (rev 65935)
@@ -19,6 +19,11 @@
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))
 
+# need to add the testing package to the pythonpath in order to
+# test python-packages-as-products
+from Products.Five.tests import testing
+sys.path.append(testing.__path__[0])
+
 def test_registerPackage():
     """
     Testing registerPackage
@@ -41,8 +46,8 @@
       ...     xmlns:five="http://namespaces.zope.org/five";
       ...     i18n_domain="foo">
       ...   <five:registerPackage
-      ...       package="Products.Five.tests.testing.pythonproduct1"
-      ...       
initialize="Products.Five.tests.testing.pythonproduct1.initialize"
+      ...       package="pythonproduct1"
+      ...       initialize="pythonproduct1.initialize"
       ...       />
       ... </configure>'''
       >>> zcml.load_string(configure_zcml)
@@ -60,8 +65,8 @@
       ...     xmlns:five="http://namespaces.zope.org/five";
       ...     i18n_domain="foo">
       ...   <five:registerPackage
-      ...       package="Products.Five.tests.testing.pythonproduct2"
-      ...       
initialize="Products.Five.tests.testing.pythonproduct2.initialize"
+      ...       package="pythonproduct2"
+      ...       initialize="pythonproduct2.initialize"
       ...       />
       ... </configure>'''
       >>> zcml.load_string(configure_zcml)
@@ -71,7 +76,7 @@
     as a zope2 product in the Control Panel.
 
       >>> productListing = app.Control_Panel.Products.objectIds()
-      >>> 'Products.Five.tests.testing.pythonproduct2' in productListing
+      >>> 'pythonproduct2' in productListing
       True
 
     Clean up:
@@ -79,6 +84,49 @@
       >>> tearDown()
     """
 
+def test_externalmethods():
+    """
+    Testing registerPackage
+
+      >>> from zope.app.testing.placelesssetup import setUp, tearDown
+      >>> setUp()
+      >>> import Products
+      >>> import Products.Five
+      >>> from Products.Five import zcml
+      >>> from Products.Five import pythonproducts
+      >>> zcml.load_config('meta.zcml', Products.Five)
+      >>> pythonproducts.setupPythonProducts(app)
+
+      >>> configure_zcml = '''
+      ... <configure
+      ...     xmlns="http://namespaces.zope.org/zope";
+      ...     xmlns:five="http://namespaces.zope.org/five";
+      ...     i18n_domain="foo">
+      ...   <five:registerPackage
+      ...       package="pythonproduct2"
+      ...       initialize="pythonproduct2.initialize"
+      ...       />
+      ... </configure>'''
+      >>> zcml.load_string(configure_zcml)
+      pythonproduct2 initialized
+      
+    Lets go ahead and try setting up an external method from the
+    pythonproduct2 product.
+    
+      >>> from Products.ExternalMethod.ExternalMethod import 
manage_addExternalMethod
+      >>> manage_addExternalMethod(app, 'testexternal', '', 
'pythonproduct2.somemodule', 'somemethod')
+      
+    Now lets actually execute the external method.
+        
+      >>> app.testexternal()
+      Executed somemethod
+
+    Clean up:
+
+      >>> tearDown()
+    """
+
+
 def test_suite():
     from Testing.ZopeTestCase import ZopeDocTestSuite
     return ZopeDocTestSuite()

Added: 
Products.Five/branches/1.4/tests/testing/pythonproduct2/Extensions/__init__.py
===================================================================

Added: 
Products.Five/branches/1.4/tests/testing/pythonproduct2/Extensions/somemodule.py
===================================================================
--- 
Products.Five/branches/1.4/tests/testing/pythonproduct2/Extensions/somemodule.py
    2006-03-12 23:20:01 UTC (rev 65934)
+++ 
Products.Five/branches/1.4/tests/testing/pythonproduct2/Extensions/somemodule.py
    2006-03-12 23:20:47 UTC (rev 65935)
@@ -0,0 +1,4 @@
+
+
+def somemethod(self):
+    print "Executed somemethod"

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to