Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume Hervier
slapos.toolbox
Commits
446bb59d
Commit
446bb59d
authored
Sep 01, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: editor interface can print utf-8 files
parent
c58dd749
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
slapos/runner/views.py
slapos/runner/views.py
+3
-3
No files found.
slapos/runner/views.py
View file @
446bb59d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# vim: set et sts=2:
# vim: set et sts=2:
# pylint: disable-msg=W0311,C0301,C0103,C0111
# pylint: disable-msg=W0311,C0301,C0103,C0111
import
codecs
import
json
import
json
import
os
import
os
import
shutil
import
shutil
...
@@ -356,10 +356,10 @@ def getFileContent():
...
@@ -356,10 +356,10 @@ def getFileContent():
return
jsonify
(
code
=
0
,
return
jsonify
(
code
=
0
,
result
=
"Can not open a binary file, please select a text file!"
)
result
=
"Can not open a binary file, please select a text file!"
)
if
'truncate'
in
request
.
form
:
if
'truncate'
in
request
.
form
:
content
=
tail
(
open
(
file_path
),
int
(
request
.
form
[
'truncate'
]))
content
=
tail
(
codecs
.
open
(
file_path
,
"r"
,
"utf_8"
),
int
(
request
.
form
[
'truncate'
]))
return
jsonify
(
code
=
1
,
result
=
content
)
return
jsonify
(
code
=
1
,
result
=
content
)
else
:
else
:
return
jsonify
(
code
=
1
,
result
=
open
(
file_path
).
read
())
return
jsonify
(
code
=
1
,
result
=
codecs
.
open
(
file_path
,
"r"
,
"utf_8"
).
read
())
else
:
else
:
return
jsonify
(
code
=
0
,
result
=
"Error: No such file!"
)
return
jsonify
(
code
=
0
,
result
=
"Error: No such file!"
)
...
...
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