Revision: 0bee914da9b7
Author:   Pekka Klärck
Date:     Mon Jun  6 14:07:09 2011
Log: Replaced `%f` directive works with datetime.strptime only in Python 2.6+. Luckily we have a utility functions for handling timestamps that can be used instead.

Hopefully acceptance tests are executed after this change.
http://code.google.com/p/robotframework/source/detail?r=0bee914da9b7

Modified:
 /src/robot/serializing/jsparser.py

=======================================
--- /src/robot/serializing/jsparser.py  Sun Jun  5 10:06:49 2011
+++ /src/robot/serializing/jsparser.py  Mon Jun  6 14:07:09 2011
@@ -4,9 +4,9 @@
 from xml.sax.handler import ContentHandler
 import zlib
 import base64
-from datetime import datetime
-from time import mktime
-from robot.utils import html_escape
+
+from robot import utils
+

 class Context(object):

@@ -41,8 +41,7 @@
     def timestamp(self, time):
         if time == 'N/A':
             return -1
-        dt = datetime.strptime(time+"000", "%Y%m%d %H:%M:%S.%f")
-        millis = int(mktime(dt.timetuple())*1000+dt.microsecond/1000)
+        millis = int(utils.timestamp_to_secs(time, millis=True) * 1000)
         if self.basemillis is None:
             self._basemillis = millis
         return millis - self.basemillis
@@ -202,7 +201,7 @@
     if node.get('html'):
         return context.get_text_id(node.text)
     else:
- return context.get_text_id(html_escape(node.text, replace_whitespace=False)) + return context.get_text_id(utils.html_escape(node.text, replace_whitespace=False))

 def _message_node_parser(node, context):
     msg = [context.timestamp(node.get('timestamp')),
@@ -497,7 +496,7 @@
         if self._is_html:
             self._msg += [self._context.get_text_id(text)]
         else:
- self._msg += [self._context.get_text_id(html_escape(text, replace_whitespace=False))] + self._msg += [self._context.get_text_id(utils.html_escape(text, replace_whitespace=False))]


 class _RootHandler(_Handler):

Reply via email to