##// END OF EJS Templates
preserve orig_nbformat when converting 3 to 4...
MinRK -
Show More
@@ -34,9 +34,10 b' def upgrade(nb, from_version=3, from_minor=0):'
34 except ValidationError as e:
34 except ValidationError as e:
35 get_logger().error("Notebook JSON is not valid v%i: %s", from_version, e)
35 get_logger().error("Notebook JSON is not valid v%i: %s", from_version, e)
36
36
37 # Mark the original nbformat so consumers know it has been converted.
37 # Mark the original nbformat so consumers know it has been converted
38 nb.pop('orig_nbformat', None)
38 orig_nbformat = nb.pop('orig_nbformat', None)
39 nb.metadata.orig_nbformat = 3
39 nb.metadata.orig_nbformat = orig_nbformat or 3
40
40 # Mark the new format
41 # Mark the new format
41 nb.nbformat = nbformat
42 nb.nbformat = nbformat
42 nb.nbformat_minor = nbformat_minor
43 nb.nbformat_minor = nbformat_minor
General Comments 0
You need to be logged in to leave comments. Login now