[Zope-dev] deep or shallow copy, or what are dtml documents good for?

Joerg Wittenberger Joerg Wittenberger <Joerg.Wittenberger@pobox.com>
Wed, 15 Sep 1999 16:29:35 +0200 (CEST)


Hello folks,

I found that zope uses deep copy with copy&paste and I found this a
bit annoying especially it plays IMHO bad together with versioning and
multiple authors.

Here a short szenario: two persons modify documents within one folder.
As soon as one mades changes to any document (within a version), the
whole folder is locked (outside of that version).  This is ok in so
far as links within that document address all other documents within
the same folder by relativ names and hence could break if somebody
modifies any other document.  In other words siblings belong somehow
into the namespace associated with a document or put differently
again: the containing folder is somehow a property of the documents
contained within.

The solution to would be to copy a folder before changing it.  Rather
wasteful and calling for the questing how to merge the branches.

Another solution was to regard the folder as the basic unit of
documents.  Now everything works as expected and required.  The
slightest modification locks the document.  Every document or method
contained within describes just a part.  The only thing missing was a
chance to explicitly lock something, but that's easy to work around
with a fake change.

The only problems with the latter approach are

a) it's regarded as strange, because people tend to thing of files aka
documents as the basic unit

b) selecting something to modify requires to first select the folder
itself and next the index_html document; often the children property
is never needed or becomes a requirement after some time passed

(It's hard to teach why people should click twice if they could solve
the problem for the short run by one click just to prevent chaos
later.)

c) the confusion about the difference between douments and methods
becomes complete, because documents are no longer needed.  All they
have in contrast to methods are attributes (meta data), which should
be associate with the folder now.

My proposal: Folders and Documents should be merged.

A dtml document should have a folderish property (say children), which
contains links to those documents, which should be addressed relativ.

When a new version is created, or the document is copied&pasted, those
links are copied as well.  But this time as a shallow, not a deep
copy.

The content of a document is just a method, which renders it's
properties.

After changing the content of a document the link within the
containing document point to the new version.  Links within the
document still share content with the original.

This raises the question, which document is the containing document.
The answer is dynamic.  In coherence with th way zope works it's
always the one, which it is accessed thru.

Additional notes:

I'm fully aware that this breaks with the traditional semantics of
files, but it goes in one line with the way xml structures documents.
See the side note about zope's limitations in the XML2Zope package.
If a document had such a folderish children property a xml document
would map to a description of a sequence of properties drawn from that
children property.  A dtml architectural dtd (formerly called meta
dtd) could map some of those elements to dtml tags.

If done properly the proposed way would unify two concepts of zope,
folders and documents.  Which in turn should be made available again
as specializations of that general type.

I'm not certain that this proposal would break any other semantics I'm
not aware of.

I'd like to discuss that topic a bit more detailed brefore making
plans to code it up.  Thanks in advance for expressing your oppinions
and objectives.

/Jerry

PS: due to mail problems please cc me to your replies.
-- 
        You can have it done fast,
        you can have it done cheap,
        and you can have it done well.
        --- But you can only have two of those at once.