[Trac-tickets] Re: [The Trac Project] #2284: Delete page exhibits same behaviour as delete version

The Trac Project noreply at edgewall.com
Wed Nov 2 20:55:34 CST 2005


#2284: Delete page exhibits same behaviour as delete version
-----------------------------------+----------------------------------------
 Reporter:  trac-form at swapoff.org  |        Owner:  jonas
     Type:  defect                 |       Status:  new  
 Priority:  normal                 |    Milestone:  0.9.1
Component:  general                |      Version:  0.9  
 Severity:  normal                 |   Resolution:       
 Keywords:                         |  
-----------------------------------+----------------------------------------
Comment (by trac-form at swapoff.org):

 Presumably this is occurring because the confirmation form has
 {{{action=""}}}:

 {{{
   <h1>Delete <a href="/wiki/FooBar">FooBar</a></h1>

   <form action="" method="post">
    <input type="hidden" name="action" value="delete" />
    <p><strong>Are you sure you want to completely delete this
 page?</strong><br />
    This is an irreversible operation.</p>
    <div class="buttons">
     <input type="submit" name="cancel" value="Cancel" />
     <input type="submit" value="Delete page" />
    </div>

   </form>
 }}}

 The URL has "version=2" in it, which then gets picked up by {{{if
 req.args.has_key('version')}}} as a sign to delete a specific version. The
 following code change fixes the issue:

 {{{
 #!diff
 Index: trac/wiki/web_ui.py
 ===================================================================
 --- trac/wiki/web_ui.py (revision 2449)
 +++ trac/wiki/web_ui.py (working copy)
 @@ -157,7 +157,7 @@
              req.redirect(self.env.href.wiki(page.name))

          version = None
 -        if req.args.has_key('version'):
 +        if req.args.has_key('delete_version') and
 req.args.has_key('version'):
              version = int(req.args.get('version', 0))

          page.delete(version, db)

 }}}

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2284>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list