Menu

Commit [r6422]  Maximize  Restore  History

WikiRename: add a method to the model for renaming a wiki page in-place.

New methods:
- `WikiPage.rename(self, new_name, db=None)`
- `Attachment.reparent_all(cls, env, old_realm, old_id, new_realm, new_id, db)`

Implementation note for `Attachment.reparent_all`: we move files individually instead of the whole folder, because:
1. this will work even if the new resource already exists (e.g. for merges)
2. it's complex when the new resource is a sub-folder if the old one
3. it's simply not possible in the general case (e.g. when the new page doesn'titself exist, but there are already sub-folders)

Note also that it's because of 3. (sub-folders may exists) that we don't remove the old attachment folder after the reparent.

cboos 2008-01-28

changed /sandbox/wiki-rename/trac/attachment.py
changed /sandbox/wiki-rename/trac/wiki/api.py
changed /sandbox/wiki-rename/trac/wiki/model.py
/sandbox/wiki-rename/trac/attachment.py Diff Switch to side-by-side view
Loading...
/sandbox/wiki-rename/trac/wiki/api.py Diff Switch to side-by-side view
Loading...
/sandbox/wiki-rename/trac/wiki/model.py Diff Switch to side-by-side view
Loading...
MongoDB Logo MongoDB