diff ipynb.py @ 1:8e8555ca07f9 draft

Uploaded
author iuc
date Mon, 28 Jul 2014 03:39:07 -0400
parents 7ae1c661a86c
children ed64ded866dd
line wrap: on
line diff
--- a/ipynb.py	Mon Jul 28 03:21:07 2014 -0400
+++ b/ipynb.py	Mon Jul 28 03:39:07 2014 -0400
@@ -1,13 +1,13 @@
 # -*- coding: utf-8 -*-
 
-from galaxy.datatypes.json import Json
+from galaxy.datatypes.json import Json as JsonClass
 from galaxy.datatypes.data import get_file_peek
 import subprocess
 import tempfile
 import json
 import os
 
-class Ipynb( Text ):
+class Ipynb( JsonClass ):
     file_ext = "ipynb"
 
     def set_peek( self, dataset, is_multi_byte=False ):
@@ -23,8 +23,8 @@
             Try to load the string with the json module. If successful it's a json file.
         """
         try:
-            json.load( filename )
-            if a.get('nbformat', False) != False and a.get('metadata', False):
+            ipynb = json.load( open(filename) )
+            if ipynb.get('nbformat', False) != False and ipynb.get('metadata', False):
                 return True
             else:
                 return False