##// END OF EJS Templates
add timezone info to `last_modified` in notebook managers...
MinRK -
Show More
@@ -26,7 +26,7 b' from tornado import web'
26 from .nbmanager import NotebookManager
26 from .nbmanager import NotebookManager
27 from IPython.nbformat import current
27 from IPython.nbformat import current
28 from IPython.utils.traitlets import Unicode, Instance
28 from IPython.utils.traitlets import Unicode, Instance
29
29 from IPython.utils import tz
30
30
31 #-----------------------------------------------------------------------------
31 #-----------------------------------------------------------------------------
32 # Classes
32 # Classes
@@ -98,7 +98,7 b' class AzureNotebookManager(NotebookManager):'
98 raise web.HTTPError(500, u'Unreadable JSON notebook.')
98 raise web.HTTPError(500, u'Unreadable JSON notebook.')
99 # Todo: The last modified should actually be saved in the notebook document.
99 # Todo: The last modified should actually be saved in the notebook document.
100 # We are just using the current datetime until that is implemented.
100 # We are just using the current datetime until that is implemented.
101 last_modified = datetime.datetime.utcnow()
101 last_modified = tz.utcnow()
102 return last_modified, nb
102 return last_modified, nb
103
103
104 def write_notebook_object(self, nb, notebook_id=None):
104 def write_notebook_object(self, nb, notebook_id=None):
@@ -28,6 +28,7 b' from tornado import web'
28 from .nbmanager import NotebookManager
28 from .nbmanager import NotebookManager
29 from IPython.nbformat import current
29 from IPython.nbformat import current
30 from IPython.utils.traitlets import Unicode, Dict, Bool, TraitError
30 from IPython.utils.traitlets import Unicode, Dict, Bool, TraitError
31 from IPython.utils import tz
31
32
32 #-----------------------------------------------------------------------------
33 #-----------------------------------------------------------------------------
33 # Classes
34 # Classes
@@ -139,7 +140,7 b' class FileNotebookManager(NotebookManager):'
139 def read_notebook_object_from_path(self, path):
140 def read_notebook_object_from_path(self, path):
140 """read a notebook object from a path"""
141 """read a notebook object from a path"""
141 info = os.stat(path)
142 info = os.stat(path)
142 last_modified = datetime.datetime.utcfromtimestamp(info.st_mtime)
143 last_modified = tz.utcfromtimestamp(info.st_mtime)
143 with open(path,'r') as f:
144 with open(path,'r') as f:
144 s = f.read()
145 s = f.read()
145 try:
146 try:
@@ -281,7 +282,7 b' class FileNotebookManager(NotebookManager):'
281 """construct the info dict for a given checkpoint"""
282 """construct the info dict for a given checkpoint"""
282 path = self.get_checkpoint_path(notebook_id, checkpoint_id)
283 path = self.get_checkpoint_path(notebook_id, checkpoint_id)
283 stats = os.stat(path)
284 stats = os.stat(path)
284 last_modified = datetime.datetime.utcfromtimestamp(stats.st_mtime)
285 last_modified = tz.utcfromtimestamp(stats.st_mtime)
285 info = dict(
286 info = dict(
286 checkpoint_id = checkpoint_id,
287 checkpoint_id = checkpoint_id,
287 last_modified = last_modified,
288 last_modified = last_modified,
General Comments 0
You need to be logged in to leave comments. Login now