Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Paul Graydon
slapos
Commits
c9868a24
Commit
c9868a24
authored
Dec 27, 2013
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recipe-zeroknown: uses class attributes as musch as possible
parent
5a84f622
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
+13
-19
slapos/recipe/zeroknown.py
slapos/recipe/zeroknown.py
+13
-19
No files found.
slapos/recipe/zeroknown.py
View file @
c9868a24
...
...
@@ -41,39 +41,33 @@ class WriteRecipe(GenericBaseRecipe):
self
.
filename
=
options
[
'filename'
].
strip
()
self
.
path
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'directory'
],
self
.
filename
)
del
options
[
'filename'
]
self
.
name
=
name
self
.
options
=
options
.
copy
()
del
self
.
options
[
'filename'
]
del
self
.
options
[
'recipe'
]
# We don't want to save the recipe name
recipe
=
options
.
pop
(
'recipe'
)
# Set up the parser, and write config file if needed
self
.
parser
=
ConfigParser
.
ConfigParser
()
try
:
self
.
parser
.
read
(
self
.
path
)
#clean_options(options)
for
key
in
options
:
if
key
not
in
self
.
parser
.
options
(
name
):
self
.
parser
.
set
(
name
,
key
,
options
[
key
])
for
key
in
self
.
options
:
if
key
not
in
self
.
parser
.
options
(
self
.
name
):
self
.
parser
.
set
(
self
.
name
,
key
,
self
.
options
[
key
])
with
open
(
self
.
path
,
'w'
)
as
file
:
self
.
parser
.
write
(
file
)
# If the file or section do not exist
except
ConfigParser
.
NoSectionError
,
IOError
:
#clean_options(options)
self
.
full_install
(
name
,
options
)
# Or buildout will fail
options
[
'recipe'
]
=
recipe
# So that we can get the value in another buildout section
options
[
'filename'
]
=
self
.
filename
self
.
full_install
()
install
=
update
=
lambda
self
:
[]
def
full_install
(
self
,
name
,
options
):
self
.
parser
.
add_section
(
name
)
for
key
in
options
:
self
.
parser
.
set
(
name
,
key
,
options
[
key
])
def
full_install
(
self
):
self
.
parser
.
read
(
self
.
path
)
self
.
parser
.
add_section
(
self
.
name
)
for
key
in
self
.
options
:
self
.
parser
.
set
(
self
.
name
,
key
,
self
.
options
[
key
])
with
open
(
self
.
path
,
'w'
)
as
file
:
self
.
parser
.
write
(
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