Skip to content

Cannot rename node to itself #797

@iivvoo

Description

@iivvoo

A node cannot be renamed to the name it already has. Doing this is silly of course, but there's no need for it to be fatal.

In [1]: from wheelcms_axle.node import Node
In [2]: root = Node.root()
In [3]: c = root.add('child')
In [4]: c.rename('child')
---------------------------------------------------------------------------
DuplicatePathException                    Traceback (most recent call last)
/.../eggs/Django-1.5.5-py2.7.egg/django/core/management/commands/shell.pyc in      <module>()
----> 1 c.rename('child')

/../src/wheelcms_axle/wheelcms_axle/node.pyc in rename(self, slug, language)
    571                 if testmode:
    572                     if Paths.objects.filter(path=newpath, language=language).exists():
--> 573                         raise DuplicatePathException(newpath, language)
    574                 else:
    575                     for p in Paths.objects.filter(Q(path=localized_path.path) |

DuplicatePathException: (u'/child', 'en')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions