Revision: 985735339980
Author:   Pekka Klärck
Date:     Mon Nov 28 05:37:49 2011
Log: Message: normalize message only when running -- otherwise it is always in correct format
http://code.google.com/p/robotframework/source/detail?r=985735339980

Modified:
 /src/robot/model/message.py
 /src/robot/output/loggerhelper.py

=======================================
--- /src/robot/model/message.py Wed Nov  9 13:21:18 2011
+++ /src/robot/model/message.py Mon Nov 28 05:37:49 2011
@@ -12,8 +12,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-from robot import utils
-
 from modelobject import ModelObject


@@ -28,12 +26,6 @@
         self.timestamp = timestamp
         self.linkable = linkable

-    @utils.setter
-    def message(self, msg):
-        if not isinstance(msg, basestring):
-            msg = utils.unic(msg)
-        return msg.replace('\r\n', '\n')
-
     def visit(self, visitor):
         visitor.visit_message(self)

=======================================
--- /src/robot/output/loggerhelper.py   Thu Nov 10 00:16:24 2011
+++ /src/robot/output/loggerhelper.py   Mon Nov 28 05:37:49 2011
@@ -66,10 +66,16 @@

     def __init__(self, message, level='INFO', html=False, timestamp=None,
                  linkable=False):
+        message = self._normalize_message(message)
         level, html = self._get_level_and_html(level, html)
         timestamp = self._get_timestamp(timestamp)
BaseMessage.__init__(self, message, level, html, timestamp, linkable)

+    def _normalize_message(self, msg):
+        if not isinstance(msg, basestring):
+            msg = utils.unic(msg)
+        return msg.replace('\r\n', '\n')
+
     def _get_level_and_html(self, level, html):
         level = level.upper()
         if level == 'HTML':

Reply via email to