#11080: move notebook to flask/wsgi-based notebook
--------------------------------------------------+-------------------------
Reporter: jason | Owner: jason,
mpatel, was
Type: enhancement | Status: needs_info
Priority: blocker | Milestone: sage-5.0
Component: notebook | Keywords: sd31
sd35.5
Work_issues: | Upstream: N/A
Reviewer: Rado Kirov, Dan Drake, Jason Grout | Author: Mike
Hansen, Rado Kirov, William Stein, Jason Grout
Merged: | Dependencies: #11078,
#11874, #12229, #11503, #12327
--------------------------------------------------+-------------------------
Comment(by kini):
The problem is as follows. In the json module, we have
{{{
If ``indent`` is a non-negative integer, then JSON array elements and
object members will be pretty-printed with that indent level. An indent
level of 0 will only insert newlines. ``None`` is the most compact
representation.
}}}
On the other hand, in the simple_json module, we have
{{{
If ``indent`` is a string, then JSON array elements and object members
will be pretty-printed with a newline followed by that string repeated
for each level of nesting. ``None`` (the default) selects the most compact
representation without any newlines. For backwards compatibility with
versions of simplejson earlier than 2.1.0, an integer is also accepted
and is converted to a string with that many spaces.
}}}
Sage integers do not trigger the following lines in simple_json
(simplejson/encoder.py:173):
{{{
#!python
if isinstance(indent, (int, long)):
indent = ' ' * indent
self.indent = indent
}}}
Unfortunately it doesn't seem like the json module supports this new
string form of the indent argument, which is why it works with our code -
it just does `' ' * indent` without caring that it's a Sage integer.
Apparently the json module is just an old version of the simplejson module
which is bundled with Python, so it will get the new string-based indent
parameter eventually, but for now we'll either have to require an up-to-
date simplejson for the new notebook, or remember/detect which of the two
modules we imported and call the function accordingly.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11080#comment:118>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.