[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_add.py:1.6.4.2

Jim Fulton jim@zope.com
Tue, 18 Mar 2003 16:58:28 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv30486

Modified Files:
      Tag: local-utility-branch
	test_add.py 
Log Message:
Needed to improve the stub name resolver to deal with real dotted
names, since the addForm now uses one automatically.


=== Zope3/src/zope/app/browser/form/tests/test_add.py 1.6.4.1 => 1.6.4.2 ===
--- Zope3/src/zope/app/browser/form/tests/test_add.py:1.6.4.1	Tue Mar 18 11:55:44 2003
+++ Zope3/src/zope/app/browser/form/tests/test_add.py	Tue Mar 18 16:58:27 2003
@@ -16,6 +16,7 @@
 $Id$
 """
 
+import sys
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.app.browser.form.add import add, AddViewFactory, AddView
 from zope.interface import Interface
@@ -31,6 +32,13 @@
 class Context:
 
     def resolve(self, name):
+        l = name.rfind('.') 
+        if l >= 0:
+            # eek, we got a real dotted name
+            m = sys.modules[name[:l]]
+            return getattr(m, name[l+1:])
+            
+            
         return globals()[name]
 
 class I(Interface):