From bc4a457fdc67485b939f07badcc15f15082f299f Mon Sep 17 00:00:00 2001 From: MinRK Date: Wed, 3 Jul 2013 12:16:22 -0700 Subject: [PATCH] add timezone info to `last_modified` in notebook managers now Firefox won't get confused, turning utc timestamps into local times. closes #3396 --- IPython/html/services/notebooks/filenbmanager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/IPython/html/services/notebooks/filenbmanager.py b/IPython/html/services/notebooks/filenbmanager.py index 16e8ce3ca..baeed9040 100644 --- a/IPython/html/services/notebooks/filenbmanager.py +++ b/IPython/html/services/notebooks/filenbmanager.py @@ -28,6 +28,7 @@ from tornado import web from .nbmanager import NotebookManager from IPython.nbformat import current from IPython.utils.traitlets import Unicode, Dict, Bool, TraitError +from IPython.utils import tz #----------------------------------------------------------------------------- # Classes @@ -139,7 +140,7 @@ class FileNotebookManager(NotebookManager): def read_notebook_object_from_path(self, path): """read a notebook object from a path""" info = os.stat(path) - last_modified = datetime.datetime.utcfromtimestamp(info.st_mtime) + last_modified = tz.utcfromtimestamp(info.st_mtime) with open(path,'r') as f: s = f.read() try: @@ -281,7 +282,7 @@ class FileNotebookManager(NotebookManager): """construct the info dict for a given checkpoint""" path = self.get_checkpoint_path(notebook_id, checkpoint_id) stats = os.stat(path) - last_modified = datetime.datetime.utcfromtimestamp(stats.st_mtime) + last_modified = tz.utcfromtimestamp(stats.st_mtime) info = dict( checkpoint_id = checkpoint_id, last_modified = last_modified,