changeset 5409:c3822eacfe4a

theme/__init__.py: Exception "Calling add_msg() after send_title(): no message can be added." is replaced with warning and call stack information in log.
author Eugene Syromyatnikov <evgsyr@gmail.com>
date Sun, 10 Jan 2010 05:01:43 +0300
parents a88ddb0f486b
children dac434907110
files MoinMoin/theme/__init__.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/theme/__init__.py	Sat Jan 09 02:41:22 2010 +0100
+++ b/MoinMoin/theme/__init__.py	Sun Jan 10 05:01:43 2010 +0300
@@ -8,6 +8,9 @@
 
 import StringIO
 
+from MoinMoin import log
+logging = log.getLogger(__name__)
+
 from MoinMoin import i18n, wikiutil, config, version, caching
 from MoinMoin.action import get_available_actions
 from MoinMoin.Page import Page
@@ -1570,7 +1573,11 @@
         if not msg_class:
             msg_class = 'dialog'
         if self._send_title_called:
-            raise Exception("You cannot call add_msg() after send_title()")
+            import traceback
+            logging.warning("Calling add_msg() after send_title(): no message can be added.")
+            logging.info('\n'.join(['Call stack for add_msg():'] + traceback.format_stack()))
+
+            return
         self._status.append((msg, msg_class))
 
     # stuff from wikiutil.py