Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
9851cf9e
Commit
9851cf9e
authored
Mar 17, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: workaround for Infinity beeing serialised by server and not supported by javascript
parent
67486af2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
dream/platform/__init__.py
dream/platform/__init__.py
+12
-1
No files found.
dream/platform/__init__.py
View file @
9851cf9e
...
@@ -34,11 +34,22 @@ import os.path
...
@@ -34,11 +34,22 @@ import os.path
import
logging
import
logging
import
simpy
import
simpy
from
flask
import
Flask
,
jsonify
,
redirect
,
url_for
from
flask
import
Flask
from
flask
import
request
from
flask
import
request
from
flask
import
jsonify
,
redirect
,
url_for
from
flask.json
import
JSONEncoder
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
)
class
InfinityJSONEncoder
(
JSONEncoder
):
# we don't serialise inf, as javascript does not load it.
def
iterencode
(
self
,
*
args
,
**
kw
):
for
j
in
JSONEncoder
.
iterencode
(
self
,
*
args
,
**
kw
):
if
"Infinity"
in
str
(
j
):
# XXX the replace should not be so "global"
j
=
j
.
replace
(
"Infinity"
,
str
(
2
**
64
))
yield
j
app
.
json_encoder
=
InfinityJSONEncoder
@
app
.
route
(
"/"
)
@
app
.
route
(
"/"
)
def
front_page
():
def
front_page
():
return
redirect
(
url_for
(
'static'
,
filename
=
'dream/index.html'
))
return
redirect
(
url_for
(
'static'
,
filename
=
'dream/index.html'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment