Modify

Opened 5 years ago

Closed 22 months ago

Last modified 22 months ago

#6429 closed defect (wontfix)

Rename to a name "deeper" in dir hierarchy fails with attachments

Reported by: anonymous Owned by: coderanger
Priority: normal Component: WikiRenamePlugin
Severity: normal Keywords: attachment
Cc: Trac Release: 0.11

Description

in the util.py it is doing an:

os.reanmes(from_path, to_path)

however if you are trying to rename:

/SomeName/SubName ==> /SomeName/SubName/ItemName

The OSError 22 happens since it is trying to move a dir to a sub dir which doesn't work. I add a tmp dir step to solve this for me.

from tempfile import mkdtemp
...
tmp_path = mkdtemp()
debug('Moving from %r to %r', from_path, tmp_path)
os.renames(from_path, tmp_path)
debug('Moving from %r to %r', tmp_path, to_path)
os.renames(tmp_path, to_path)

Attachments (0)

Change History (5)

comment:1 Changed 5 years ago by anonymous

  • Summary changed from Rename to a a name "deeper" in heirarchy fails with attachments to Rename to a name "deeper" in heirarchy fails with attachments

comment:2 in reply to: ↑ description Changed 5 years ago by anonymous

Replying to anonymous:
Or formatted correctly :)

in the util.py it is doing an:

from tempfile import mkdtemp>
...
tmp_path = mkdtemp()
debug('Moving from %r to %r', from_path, tmp_path)
os.renames(from_path, tmp_path)
debug('Moving from %r to %r', tmp_path, to_path)
os.renames(tmp_path, to_path)

comment:3 Changed 4 years ago by hasienda

  • Keywords attachment added
  • Summary changed from Rename to a name "deeper" in heirarchy fails with attachments to Rename to a name "deeper" in dir hierarchy fails with attachments

since this looks reasonable, just a quick question to (anonymous):

Did you check a situation the other way round too:
i.e. /SomeName/SubName/ItemName ==> /SomeName/SubName

looks as if there would arise the need check, if there is an empty dir left, that should be deleted IMHO for good housekeeping in filesystem, right?

comment:4 Changed 22 months ago by rjollos

  • Resolution set to wontfix
  • Status changed from new to closed

The plugin is deprecated since there is now support in the Trac core.

comment:5 Changed 22 months ago by rjollos

If you'd like to apply patches I can provide you commit access.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from coderanger. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.