Revision: 192
Author:   mikko.korp...@gmail.com
Date:     Wed Oct 10 05:14:44 2012
Log:      Fix invalid timestamp
http://code.google.com/p/robotframework-mabot/source/detail?r=192

Modified:
 /trunk/src/mabot/model/model.py

=======================================
--- /trunk/src/mabot/model/model.py     Thu Mar 22 01:30:24 2012
+++ /trunk/src/mabot/model/model.py     Wed Oct 10 05:14:44 2012
@@ -14,6 +14,8 @@


 import tkMessageBox
+from datetime import datetime
+from time import time

 from mabot.settings import SETTINGS
 from mabot import utils
@@ -661,13 +663,19 @@
 class ManualMessage(object):

     def __init__(self, message, status, timestamp=None, level=None):
-        self.timestamp = timestamp or '00000000 00:00:00.000'
-        status_level = status == 'PASS' and 'INFO' or 'FAIL'
-        self.level = level or status_level
+ self.timestamp = timestamp or datetime.fromtimestamp(time()).strftime('%Y%m%d %H:%M:%S.000')
+        self.level = self._get_level(level, status)
         self.message = message
         self.html = False
         self.linkable = False

+    def _get_level(self, level, status):
+        if level:
+            return level
+        if status == 'PASS':
+            return 'INFO'
+        return 'FAIL'
+
     def serialize(self, serializer):
         serializer.log_message(self)

Reply via email to