Commits

Ezio Melotti  committed d7c9e0b

Fix clean up of ok_message.

  • Participants
  • Parent commits 4cdbeb1

Comments (0)

Files changed (2)

File extensions/pydevutils.py

+import re
 import random
 from roundup.cgi.actions import Action
 from roundup.cgi.exceptions import Redirect
     db = request.client.db
     return 'Coordinator' in db.user.get(user, 'roles')
 
+def clean_ok_message(ok_message):
+    """Remove nosy_count and message_count from the ok_message."""
+    pattern = '\s*(?:nosy|message)_count,|,\s*(?:nosy|message)_count(?= edited)'
+    return '\n'.join(re.sub(pattern, '', line) for line in ok_message) + '\n'
+
 
 def issueid_and_action_from_class(cls):
     """
 def init(instance):
     instance.registerUtil('is_history_ok', is_history_ok)
     instance.registerUtil('is_coordinator', is_coordinator)
+    instance.registerUtil('clean_ok_message', clean_ok_message)
     instance.registerUtil('issueid_and_action_from_class',
                           issueid_and_action_from_class)
     instance.registerAction('random', RandomIssueAction)

File html/page.html

     tal:repeat="m options/error_message" tal:content="m" />
  <p tal:condition="options/ok_message | nothing" class="ok-message">
   <span style="white-space:pre" tal:content="python:
-        '\n'.join(', '.join(m.strip() for m in line.split(',') if '_count' not in m)
-                  for line in options['ok_message']) + '\n'" />
+        utils.clean_ok_message(options['ok_message'])" />
   <a class="form-small" tal:attributes="href request/current_url"
      i18n:translate="">clear this message</a>
  </p>