Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

#8859 closed defect (fixed)

page parameter "author" in "wiki_page_added" and "wiki_page_deleted" methods is empty

Reported by: bestkontakt@… Owned by: Remy Blank
Priority: normal Milestone: 0.12
Component: wiki system Version: 0.12dev
Severity: normal Keywords: IWikiChangeListener
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

By using the implemented methods from "IWikiChangeListener" I tried to get the author parameter from page (page.author). Every time the value is empty and author is unknown then.

Attachments (1)

8859-wiki-model-r8872.patch (3.6 KB ) - added by Remy Blank 15 years ago.
Additional tests and fix for this issue.

Download all attachments as: .zip

Change History (9)

comment:1 by Remy Blank, 15 years ago

Milestone: 0.12-multirepos0.12
Owner: set to Remy Blank

Indeed, this seems to be the case, as we don't update the .author field in WikiPage.save().

by Remy Blank, 15 years ago

Attachment: 8859-wiki-model-r8872.patch added

Additional tests and fix for this issue.

comment:2 by Remy Blank, 15 years ago

Keywords: multirepos removed

The patch above (against trunk) should fix the issue.

One thing I wasn't sure of: when creating a WikiPage for an existing page with version=None, the .version attribute is set to the latest version number, but .resource.version is still None. Is this intentional, or should .version and .resource.version always be synchronized?

comment:3 by bestkontakt@…, 15 years ago

The patched model.py is still does not contain the .author filed in "wiki_page_deleted" method. Tried it for many times and it always was empty. Tried to set

self.author = author
self.comment = comment
self.time = t

in delete method but got an error then.

The other thing i watched is the empty .comment field (page.comment) in all methods from IWikiChangeListener.

comment:4 by Remy Blank, 15 years ago

I'm afraid I don't understand what you are trying to do. Could you please attach the code of your Component implementing IWikiChangeListener and demonstrating the issue?

comment:5 by Remy Blank, 15 years ago

Ah, now I understand. When a WikiPage is deleted, it tries to fetch the latest page version from the database. See [2248] for an explanation. I'm not sure how useful this behavior is, though.

comment:6 by anonymous, 15 years ago

Sorry, I did not really understand how the 2248 can be usefull. I did following, I moved the code

if version is None or version == self.version:
            self._fetch(self.name, None, db)

on the top, before the code for deleting the page will be executed. So I can get data before the page will be deleted. But after deleting the page I get an error:

File "/Library/Python/2.6/site-packages/Trac-0.12multirepos_r0-py2.6.egg/trac/web/main.py", line 467, in _dispatch_request
  dispatcher.dispatch(req)
File "/Library/Python/2.6/site-packages/Trac-0.12multirepos_r0-py2.6.egg/trac/web/main.py", line 212, in dispatch
  resp = chosen_handler.process_request(req)
File "/Library/Python/2.6/site-packages/Trac-0.12multirepos_r0-py2.6.egg/trac/wiki/web_ui.py", line 147, in process_request
  self._do_delete(req, versioned_page)
File "/Library/Python/2.6/site-packages/Trac-0.12multirepos_r0-py2.6.egg/trac/wiki/web_ui.py", line 269, in _do_delete
  version=version, name=page.name))
File "/Library/Python/2.6/site-packages/Trac-0.12multirepos_r0-py2.6.egg/trac/util/translation.py", line 40, in gettext_noop
  return safefmt(string, kwargs)
File "/Library/Python/2.6/site-packages/Trac-0.12multirepos_r0-py2.6.egg/trac/util/translation.py", line 33, in safefmt
  return string % kwargs

comment:7 by Remy Blank, 15 years ago

What I meant is that the behavior you observe seems to be intentional (according to the commit message in [2248]), but I'm not sure if it really makes sense.

comment:8 by Remy Blank, 15 years ago

Resolution: fixed
Status: newclosed

Patch applied in [8915].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.