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
Lu Xu
slapos.toolbox
Commits
ab224625
Commit
ab224625
authored
Jul 26, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: use context manager for open(.., 'w')
parent
ccd8605a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
10 deletions
+7
-10
slapos/runner/runnertest.py
slapos/runner/runnertest.py
+2
-3
slapos/runner/utils.py
slapos/runner/utils.py
+2
-3
slapos/runner/views.py
slapos/runner/views.py
+3
-4
No files found.
slapos/runner/runnertest.py
View file @
ab224625
...
...
@@ -89,9 +89,8 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
app
=
views
.
app
.
test_client
()
self
.
app
.
config
=
views
.
app
.
config
#Create password recover code
rpwd
=
open
(
os
.
path
.
join
(
views
.
app
.
config
[
'etc_dir'
],
'.rcode'
),
'w'
)
rpwd
.
write
(
self
.
rcode
)
rpwd
.
close
()
with
open
(
os
.
path
.
join
(
views
.
app
.
config
[
'etc_dir'
],
'.rcode'
),
'w'
)
as
rpwd
:
rpwd
.
write
(
self
.
rcode
)
def
tearDown
(
self
):
"""Remove all test data"""
...
...
slapos/runner/utils.py
View file @
ab224625
...
...
@@ -296,9 +296,8 @@ def config_SR_folder(config):
#create symlink
os
.
symlink
(
source
,
destination
)
#write config file
cf
=
open
(
cfg
,
'w'
)
cf
.
write
(
current_project
+
"#"
+
folder
)
cf
.
close
()
with
open
(
cfg
,
'w'
)
as
cf
:
cf
.
write
(
current_project
+
'#'
+
folder
)
def
loadSoftwareRList
(
config
):
...
...
slapos/runner/views.py
View file @
ab224625
...
...
@@ -536,12 +536,11 @@ def saveParameterXml():
content
=
request
.
form
[
'parameter'
].
encode
(
"utf-8"
)
param_path
=
os
.
path
.
join
(
app
.
config
[
'etc_dir'
],
".parameter.xml"
)
try
:
f
=
open
(
param_path
,
'w'
)
f
.
write
(
content
)
f
.
close
()
with
open
(
param_path
,
'w'
)
as
f
:
f
.
write
(
content
)
result
=
readParameters
(
param_path
)
except
Exception
as
e
:
result
=
str
(
e
)
result
=
str
(
e
)
software_type
=
None
if
request
.
form
[
'software_type'
]:
software_type
=
request
.
form
[
'software_type'
]
...
...
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