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
Eric Zheng
slapos.toolbox
Commits
570c4f1d
Commit
570c4f1d
authored
Jun 21, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing changes for utf-8 encoding
parent
652bc606
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
14 deletions
+27
-14
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+1
-1
slapos/runner/templates/instanceInspect.html
slapos/runner/templates/instanceInspect.html
+2
-1
slapos/runner/utils.py
slapos/runner/utils.py
+11
-5
slapos/runner/views.py
slapos/runner/views.py
+13
-7
No files found.
slapos/runner/static/css/styles.css
View file @
570c4f1d
...
...
@@ -42,7 +42,7 @@ textarea {
}
body
{
background
:
url("../images/1307251316-background-stripes.gif")
repeat
#9C9C9C
;
background
:
#2281C1
;
/*url("../images/1307251316-background-stripes.gif") repeat #9C9C9C;*/
font-family
:
'Helvetica Neue'
,
Tahoma
,
Helvetica
,
Arial
,
sans-serif
;
color
:
#000000
;
font-size
:
13px
;
...
...
slapos/runner/templates/instanceInspect.html
View file @
570c4f1d
...
...
@@ -116,7 +116,8 @@
</table>
</div>
</div>
<div
style=
"margin-left:10px;"
>
<br/>
<div>
<a
id=
"updateParameters"
class=
"lshare simple no-right-border"
style=
"float:left"
>
Update Values
</a>
<a
href=
"#"
id=
"xmlview"
class=
"lshare simple"
style=
"float:left"
>
Load XML
</a>
</div>
...
...
slapos/runner/utils.py
View file @
570c4f1d
...
...
@@ -41,9 +41,17 @@ def html_escape(text):
return
""
.
join
(
html_escape_table
.
get
(
c
,
c
)
for
c
in
text
)
def
checkLogin
(
config
,
login
,
pwd
):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
config
[
'runner_workdir'
],
'.users'
)):
return
False
user
=
open
(
os
.
path
.
join
(
config
[
'runner_workdir'
],
'.users'
),
'r'
).
read
().
split
(
';'
)
user_path
=
os
.
path
.
join
(
config
[
'runner_workdir'
],
'.users'
)
user
=
""
if
os
.
path
.
exists
(
user_path
):
user
=
open
(
user_path
,
'r'
).
read
().
split
(
';'
)
if
type
(
user
)
==
type
(
""
):
#Error: try to restore data from backup
if
os
.
path
.
exists
(
user_path
+
'.back'
):
os
.
rename
(
user_path
+
'.back'
,
user_path
)
user
=
open
(
user_path
,
'r'
).
read
().
split
(
';'
)
else
:
return
False
salt
=
"runner81"
#to be changed
current_pwd
=
hashlib
.
md5
(
salt
+
pwd
).
hexdigest
()
if
current_pwd
==
user
[
1
]:
...
...
@@ -102,8 +110,6 @@ def updateProxy(config):
sr_request
=
slap
.
registerOpenOrder
().
request
(
profile
,
partition_reference
=
getSoftwareReleaseName
(
config
),
partition_parameter_kw
=
partition_parameter_kw
,
software_type
=
None
,
filter_kw
=
None
,
state
=
None
,
shared
=
False
)
#open(param_path, 'w').write(xml_marshaller.dumps(sr_request.
# getInstanceParameterDict()))
return
True
def
readPid
(
file
):
...
...
slapos/runner/views.py
View file @
570c4f1d
...
...
@@ -17,7 +17,10 @@ def before_request():
and
request
.
path
!=
'/login'
\
and
request
.
path
!=
'/doLogin'
and
not
request
.
path
.
startswith
(
'/static'
):
return
redirect
(
url_for
(
'login'
))
session
[
'title'
]
=
getProjectTitle
(
app
.
config
)
if
session
.
has_key
(
'account'
)
and
session
[
'account'
]:
session
[
'title'
]
=
getProjectTitle
(
app
.
config
)
session
[
'account'
]
=
open
(
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
'.users'
),
'r'
).
read
().
split
(
';'
)
# general views
@
app
.
route
(
'/'
)
...
...
@@ -33,7 +36,7 @@ def login():
@
app
.
route
(
"/myAccount"
)
def
myAccount
():
return
render_template
(
'account.html'
,
username
=
session
[
'account'
][
0
],
email
=
session
[
'account'
][
2
],
name
=
session
[
'account'
][
3
]
)
email
=
session
[
'account'
][
2
],
name
=
session
[
'account'
][
3
].
decode
(
'utf-8'
)
)
@
app
.
route
(
"/logout"
)
def
logout
():
...
...
@@ -447,20 +450,23 @@ def getParameterXml(request):
@
app
.
route
(
"/updateAccount"
,
methods
=
[
'POST'
])
def
updateAccount
():
account
=
session
[
'account'
]
account
=
session
[
'account'
]
[:]
#copy session data
user
=
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
'.users'
)
try
:
if
request
.
form
[
'username'
].
strip
():
account
[
0
]
=
request
.
form
[
'username'
].
strip
()
account
[
2
]
=
request
.
form
[
'email'
].
strip
()
account
[
3
]
=
request
.
form
[
'name'
].
strip
()
.
encode
(
"utf-8"
)
account
[
3
]
=
request
.
form
[
'name'
].
strip
()
if
request
.
form
[
'password'
].
strip
():
account
[
1
]
=
request
.
form
[
'password'
].
strip
()
salt
=
"runner81"
#to be changed
account
[
1
]
=
hashlib
.
md5
(
salt
+
request
.
form
[
'password'
].
strip
()).
hexdigest
()
#backup previous data
open
(
user
+
'.back'
,
'w'
).
write
(
';'
.
join
(
session
[
'account'
]))
#save new account data
open
(
user
,
'w'
).
write
(
';'
.
join
(
account
))
open
(
user
,
'w'
).
write
(
(
';'
.
join
(
account
)).
encode
(
"utf-8"
))
session
[
'account'
]
=
account
return
jsonify
(
code
=
1
,
result
=
""
)
except
Exception
,
e
:
os
.
remove
(
user
)
o
pen
(
user
,
'w'
).
write
(
';'
.
join
(
session
[
'account'
])
)
o
s
.
rename
(
user
+
'.back'
,
user
)
return
jsonify
(
code
=
0
,
result
=
str
(
e
))
\ No newline at end of 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