[Zope-CVS] CVS: Products/ExternalMount - ExternalMount.py:1.4

Shane Hathaway shane@cvs.zope.org
Thu, 29 Aug 2002 16:24:47 -0400


Update of /cvs-repository/Products/ExternalMount
In directory cvs.zope.org:/tmp/cvs-serv25975

Modified Files:
	ExternalMount.py 
Log Message:
When adding a mount point, ensure the meta_type of the faux object matches
the meta_type of the object being mounted.  Otherwise objectIds(meta_type)
does not work correctly.


=== Products/ExternalMount/ExternalMount.py 1.3 => 1.4 ===
--- Products/ExternalMount/ExternalMount.py:1.3	Wed Aug 28 14:06:28 2002
+++ Products/ExternalMount/ExternalMount.py	Thu Aug 29 16:24:46 2002
@@ -103,18 +103,23 @@
         return apply(self.__exm, (), {})
 
 manage_addExternalMountForm=Globals.HTMLFile('ExMountForm', globals())
-def manage_addExternalMount(self, path, module, function, REQUEST=None):
+def manage_addExternalMount(dispatcher, path, module, function, REQUEST=None):
     "Mount a Zope database via an ExternalMethod"
     if not path: raise ValueError, 'No Path given'
     
-    f = ExternalMount(path, module, function)
-    self = self.this()
-    f._test(self)  # Test the connection.
+    mount = ExternalMount(path, module, function)
+    container = dispatcher.this()
+    mount._test(container)  # Test the connection.
+    resolved = mount.__of__(container)
+
     # Add a faux object to avoid generating events while appeasing
     # OFS.ObjectManager._setObject(), then discreetly
     # replace the faux object.
-    self._setObject(f.id, Folder())
-    self._setOb(f.id, f)
+    faux = Folder()
+    faux.id = resolved.getId()
+    faux.meta_type = resolved.meta_type
+    container._setObject(faux.id, faux)
+    container._setOb(faux.id, mount)
     if REQUEST is not None:
-        REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
+        REQUEST['RESPONSE'].redirect(container.absolute_url()+'/manage_main')