Data attribute inconsitency in trac.wiki.model.WikiPage while renaming a page
|Reported by:||Steffen Hoffmann||Owned by:||Steffen Hoffmann|
When implementing an
IWikiChangeListener for th:wiki:VotePlugin the initial draft didn't work as expected.
By comparing to known-good code for th:wiki:TagsPlugin I noticed, that there the new name is taken from
page.name, while now I relied on the
I feel that the current method
WikiPage.rename is flawed since the initial commit in r9362 where it is updating only page.name but leaving page.resource unchanged. The
WikiPage object passed to change listeners has both, the old and new name, and this is certainly unintended. However, it is easy to fix:
diff -u trac/wiki/model.py trac/wiki/model.py
a b 189 189 Attachment.reparent_all(self.env, 'wiki', old_name, 'wiki', 190 190 new_name) 191 191 192 self. name = new_name 192 self.name = new_name 193 193 self.env.log.info('Renamed page %s to %s', old_name, new_name) 194 194 195 195 for listener in WikiSystem(self.env).change_listeners:
I propose to fix it in stable and old-stable too.