Description

Create a new page (say, a bug report where you pick the BugTemplate to pre-fill the edit textarea) and start writing something. Then click "Clear message" in the message box above. You just lost all your data, because "Clear message" is a link to ?action=show, which, since you're writing a new page, throws you back to the "this page doesn't exists yet" page. Most bogus.

Details

This Wiki.

Workaround

Teach your users to use their browser's Back button :) let you return to your unsaved text.

Alternately, hack up your theme's .py file to overload the msg function like so:

   1     def msg(self, d):
   2         """
   3         Assemble the msg display
   4         
   5         @param d: parameter dictionary
   6         @rtype: string
   7         @return: msg display html
   8         """
   9         html = ''
  10         if d['msg']:
  11             _ = self.request.getText
  12     
  13             d.update({'link_text': _('Clear message'),})
  14             clear_msg_link = ('<a href="%(script_name)s/%(q_page_name)s?'
  15                               'action=show">%(link_text)s</a>') % d
  16             d.update({'clear_msg_link': clear_msg_link,})
  17             html = '''
  18 <div id="message">
  19     <p>%(msg)s</p>''' % d
  20             if not self.request.form.get('action', [''])[0] == 'edit':
  21                 html = html + '''
  22     <div class="buttons">%(clear_msg_link)s</div>''' % d
  23             html = html + '''
  24 </div>'''
  25         return html

With this code, the "Clear message" link doesn't appear on the edit pages. I think this is a reasonable solution.

Discussion

I think we need more advanced message system, like sending a Message object, that contain message main text (displayed in bold type), more text in needed (displayed in regular type) and several buttons, like "Ok" "Cancel" or custom buttons.

But for 1.3 I think the proposed patch is just fine and I will apply it soon. Thanks for the patch.

-- NirSoffer 2004-11-17 02:58:24

Plan

apply proposed patch


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/ClearMessageOnEditCanLoseData (last edited 2007-10-29 19:14:43 by localhost)