ContainerItemRenamer deletes objects when renames are not allowed

Bug #123532 reported by Marius Gedminas on 2007-07-02
4
Affects Status Importance Assigned to Milestone
Zope 3
Undecided
Unassigned
zope.copypastemove
Medium
Ilshad Khabibullin

Bug Description

Reported by Christophe Combelles on <email address hidden>:

> I've experienced a dangerous behaviour with namechoosers :
>
> If the namechooser computes a name which is the same as the current name,
> the object is deleted!
>
> This is simple to reproduce :
> - register a name chooser that only returns "foobar"
> - create your object → ok it's name is foobar
> - from the Contents view of it's container, try to rename it (with a
> different name)
> - → deleted
>
> Someone should try to reproduce that, to be sure that's not a side effect
> of my app, but I don't think so.

Here's a unit test that reproduces the bug:

mg@pitonas:~/src/Zope3 $ ./test.py -pv -s zope.copypastemove
Running tests at level 1
Running unit tests:
  Running:
    46/46 (100.0%) doctest_renaming_with_obstinate_name_chooser (zope.copypastemove.tests.test_rename)

Failure in test doctest_renaming_with_obstinate_name_chooser (zope.copypastemove.tests.test_rename)
Failed doctest test for zope.copypastemove.tests.test_rename.doctest_renaming_with_obstinate_name_chooser
  File "/home/mg/src/Zope3/src/zope/copypastemove/tests/test_rename.py", line 32, in doctest_renaming_with_obstinate_name_chooser

----------------------------------------------------------------------
File "/home/mg/src/Zope3/src/zope/copypastemove/tests/test_rename.py", line 67, in
zope.copypastemove.tests.test_rename.doctest_renaming_with_obstinate_name_chooser
Failed example:
    list(container)
Expected:
    [u'foobar']
Got:
    []

  Ran 46 tests with 1 failures and 0 errors in 0.081 seconds.

Marius Gedminas (mgedmin) wrote :
Tres Seaver (tseaver) on 2010-04-15
Changed in zope3:
status: New → Won't Fix
Tres Seaver (tseaver) on 2010-04-21
tags: added: bugday20100424
Tres Seaver (tseaver) wrote :

The patch applies cleanly to the zope.copypastemove trunk, but the test fails for reasons unrelated to the reported bug, as it depends on being able to import zope.app.container.sample, which is no longer a testing dependency. Likely we just need to write a dumb mock container inline in the test (which I would write as a unit test, but that is a de gustibus point).

Changed in zope.copypastemove:
importance: Undecided → Medium
status: New → Incomplete
Changed in zope.copypastemove:
assignee: nobody → Ilshad Khabibullin (astoon)
Ilshad Khabibullin (astoon) wrote :

Added additional check for the same container and the same name after name chooser working.
Unfortunately we can't just move exist check, so need additional check.
Commit into trunk.

Changed in zope.copypastemove:
status: Incomplete → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers