[Zope3-dev] [Fwd: [Z3d] 562/ 3 Reject "ObjectCopier must copy not reference the object"]

Egon Frerich e.frerich at nord-com.net
Tue Aug 22 19:41:54 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I put some minimal files together and uploaded them to the Collector so
that the problem should be more clear.

Some remarks about the IRC log (2006-08-17):
"
> faassen	so that if he changes something in the original, it also changes in the copy, or vice versa"

I do not change something in the original so there is no change in the
copy. Let me explain what had happen.

The object name in a container should be the same as the value in a
datafield. If you add an object the NameChooser takes the value from
this datafield.

If you want to copy an object in the ZMI the copy must have another
object name because the names in a container must be unambigous. So the
NameChooser find a new name. The solution is to supplement the object
name with a prefix. In my solution this is the prefix "Copy". If the
original object has the object name "kitchen" the copy gets the name
"Copykitchen". An as the name of the object should be the same as the
value of the datafield (from which the object name originally comes) the
datafield in the copy is changed from the NameChooser accordlingly. So
in the datafield von object "Copykitchen" we find the value
"Copykitchen". That is correct. The change in this datafield doesn't
happened manually. It happens by the NameChooser.

> philiKON	his logic in the namechooser seems bogus too

Can you please be more specific?

Egon

.

- -------- Original-Nachricht --------
Betreff: [Z3d] 562/ 3 Reject "ObjectCopier must copy not reference the
object"

[snip]

Issue #562 Update (Reject) "ObjectCopier must copy not reference the object"
 Status Rejected, community/issue critical
To followup, visit:
  http://www.zope.org/Collectors/Zope3-dev/562

==============================================================
= Reject - Entry #3 by faassen on Aug 17, 2006 7:46 am

 Status: Pending => Rejected

I'm not sure I understand the report fully. The claim is that no copy is
made by the ObjectCopier but references are made only. This is not true
for the ObjectCopier - it does make copies (though in some cases it will
make references if there is a reference in the object to an object in
another location).

It's possible something special happens in case of the use of the object
name. More details are needed here.

For the time being, I'm going to reject this issue, but please
give us a more detailed description about what's going on first.

[snip]
_______________________________________
= Edit - Entry #2 by srichter on Jun 16, 2006 8:20 am

 Changes: submitter email, importance (medium => critical)
________________________________________
= Request - Entry #1 by Frerich on Mar 3, 2006 5:14 pm

In my application one of the contenttype datafields should be the
objectname in the container. With a subclass of NameChooser I managed to
add content objects into the container with an objectname which is
identical with a name in a datafield.

In the container view it is possible to select id(s) for copying and
then to paste the selected objects into the same or into another container.

If the objectname of a pasted object is already in the container the
UserError "The given name is already being used" is triggered. Therefore
I programmed in the NameChooser:

    def chooseName(self, name, object):
        name = object.RaumName
        try:
            self.checkName(name, object)
        except UserError, e:
            if str(e) == "The given name is already being used":
                object.RaumName = u"Copy" + object.RaumName
                self.chooseName('', object)
                name = object.RaumName
                return name
        return name

So we get unambiguous objectnames for the container (maybe
"CopyCopyObject").

And the datafield in the object (here: RaumName) is synchronized with
the objectname.

Since the ObjectCopier doesn't create a real copy but references only
the object the datafield is changed in two objects: in the *original*
object and the copied object. And the content of datafield in the
original object (something with "Copy") is different from the objectname
(without "Copy").
==============================================================



- --
Egon Frerich, Freudenbergstr. 16, 28213 Bremen

E-Mail: e.frerich at nord-com.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE65ZBuTzybIiyjvURAuEDAKCbvsMX6jOPShbo3+HAdcmi3SYU8QCfaanB
LCt1+jb65ml1ObUGmdza+eY=
=9PO7
-----END PGP SIGNATURE-----


More information about the Zope3-dev mailing list