[ZCM] [ZC] 1578/ 4 Comment "Mounting a non-folder object fails"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Wed Dec 29 07:51:06 EST 2004


Issue #1578 Update (Comment) "Mounting a non-folder object fails"
 Status Pending, Zope/bug+solution low
To followup, visit:
  http://zope.org/Collectors/Zope/1578

==============================================================
= Comment - Entry #4 by clebeaupin on Dec 29, 2004 7:50 am

I have used your patch and it works fine. I have another problem when I want to mount a folder in a plone site.

mount is /myplone/content

It works with a PloneFolder but not with an ATFolder. 
Why? Because in manage_afterAdd method of ATFolder, we need to access a tool in the Plone site. When mounting the folder, the container sees only content folder.
Maybe a problem of acquisition in the container

________________________________________
= Comment - Entry #3 by ree on Nov 20, 2004 11:58 am

The class has content, but the content is stored in
OOBTrees and is meant to be manipulated by means of
special methods. It is not meant to be manipulated by
the folder interface, and so it does not inherit from
Folder or implement its interface.

But it stores a lot of data (this is a counter-like
object), and it deserves an own storage, independent 
from the main db. Basically this object has a separate
db on his own.

Of course it would be also be possible to mount a 
simple Folder instead, and put the object inside it,
but it is a straightforward idea to mount it directly
as well.
________________________________________
= Comment - Entry #2 by ajung on Nov 20, 2004 11:01 am

"""I wanted (through dbtab) to mount a custom product that is not a Folder."""

This means what? In my understanding it makes only sense to mount
folders or folderish objects.


________________________________________
= Request - Entry #1 by ree on Nov 16, 2004 7:24 am


Uploaded:  "MountedObject.py.patch"
 - http://zope.org/Collectors/Zope/1578/MountedObject.py.patch/view
I wanted (through dbtab) to mount a custom product that is not a Folder. However, I get an error after creation (from create as ZODB Mount Point):

...
  File "/usr/lib/zope2.7/lib/python/Products/ZODBMountPoint/MountedObject.py", line 73, in traverseOrConstruct
    container = self._construct(container, part)
  File "/usr/lib/zope2.7/lib/python/Products/ZODBMountPoint/MountedObject.py", line 103, in _construct
    context._setObject(id, obj)
AttributeError: _setObject

Why is that? I don't see any reason that would prevent mounting an object that is not a Folder and thus does not implement _setObject.

I think the problem is in the CustomTrailblazer. It creates the custom object on every path level, supposing the custom object is a folder. But it should only create the custom object at the end of the path chain, and create normal folders on the way there. (Also, I think this would be a more sensible behaviour even if the object were a Folder.)

I include a patch for this.
==============================================================



More information about the Zope-Collector-Monitor mailing list