Repository: ipython/ipython

Issue:
GenericCheckpointsMixin missing methods
In the commit https://github.com/ipython/ipython/commit/82dcba3ba9ffa3ee3193602e2d5df3ef3c3de106 two new methods were introduced `get_notebook_checkpoint` and `get_file_checkpoint` but the definition of 
`GenericCheckpointsMixin` itself was not updated. 

It still has `get_checkpoint` method. Subclasses work now, but just thought of notifying it.

The file in question is: `ipython/IPython/html/services/contents/checkpoints.py` and the branch https://github.com/ipython/ipython/releases/tag/rel-3.1.0



Discussion:

Resolving patch:
diff --git a/IPython/html/services/contents/checkpoints.py b/IPython/html/services/contents/checkpoints.py
--- a/IPython/html/services/contents/checkpoints.py
+++ b/IPython/html/services/contents/checkpoints.py
@@ -67,7 +67,7 @@ class GenericCheckpointsMixin(object):
     - get_notebook_checkpoint(self, checkpoint_id, path)
 
     To create a generic CheckpointManager, add this mixin to a class that
-    implement the above three methods plus the remaining Checkpoints API
+    implement the above four methods plus the remaining Checkpoints API
     methods:
 
     - delete_checkpoint(self, checkpoint_id, path)
@@ -118,10 +118,25 @@ def create_notebook_checkpoint(self, nb, path):
         """
         raise NotImplementedError("must be implemented in a subclass")
 
-    def get_checkpoint(self, checkpoint_id, path, type):
-        """Get the content of a checkpoint.
+    def get_file_checkpoint(self, checkpoint_id, path):
+        """Get the content of a checkpoint for a non-notebook file.
 
-        Returns an unvalidated model with the same structure as
-        the return value of ContentsManager.get
+        Returns a dict of the form:
+        {
+            'type': 'file',
+            'content': <str>,
+            'format': {'text','base64'},
+        }
+        """
+        raise NotImplementedError("must be implemented in a subclass")
+
+    def get_notebook_checkpoint(self, checkpoint_id, path):
+        """Get the content of a checkpoint for a notebook.
+
+        Returns a dict of the form:
+        {
+            'type': 'notebook',
+            'content': <output of nbformat.read>,
+        }
         """
         raise NotImplementedError("must be implemented in a subclass")
diff --git a/IPython/html/services/contents/filecheckpoints.py b/IPython/html/services/contents/filecheckpoints.py
--- a/IPython/html/services/contents/filecheckpoints.py
+++ b/IPython/html/services/contents/filecheckpoints.py
@@ -142,7 +142,7 @@ class GenericFileCheckpoints(GenericCheckpointsMixin, FileCheckpoints):
     ContentsManager.
     """
     def create_file_checkpoint(self, content, format, path):
-        """Create a checkpoint from the current content of a notebook."""
+        """Create a checkpoint from the current content of a file."""
         path = path.strip('/')
         # only the one checkpoint ID:
         checkpoint_id = u"checkpoint"
@@ -168,7 +168,7 @@ def create_notebook_checkpoint(self, nb, path):
         return self.checkpoint_model(checkpoint_id, os_checkpoint_path)
 
     def get_notebook_checkpoint(self, checkpoint_id, path):
-
+        """Get a checkpoint for a notebook."""
         path = path.strip('/')
         self.log.info("restoring %s from checkpoint %s", path, checkpoint_id)
         os_checkpoint_path = self.checkpoint_path(checkpoint_id, path)
@@ -185,6 +185,7 @@ def get_notebook_checkpoint(self, checkpoint_id, path):
         }
 
     def get_file_checkpoint(self, checkpoint_id, path):
+        """Get a checkpoint for a file."""
         path = path.strip('/')
         self.log.info("restoring %s from checkpoint %s", path, checkpoint_id)
         os_checkpoint_path = self.checkpoint_path(checkpoint_id, path)


Test patch: