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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Klaus Wölfel
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
Show 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):
...
@@ -41,39 +41,33 @@ class WriteRecipe(GenericBaseRecipe):
self
.
filename
=
options
[
'filename'
].
strip
()
self
.
filename
=
options
[
'filename'
].
strip
()
self
.
path
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'directory'
],
self
.
filename
)
self
.
path
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'directory'
],
self
.
filename
)
del
options
[
'filename'
]
self
.
name
=
name
self
.
options
=
options
.
copy
()
# We don't want to save the recipe name
del
self
.
options
[
'filename'
]
recipe
=
options
.
pop
(
'recipe'
)
del
self
.
options
[
'recipe'
]
# Set up the parser, and write config file if needed
# Set up the parser, and write config file if needed
self
.
parser
=
ConfigParser
.
ConfigParser
()
self
.
parser
=
ConfigParser
.
ConfigParser
()
try
:
try
:
self
.
parser
.
read
(
self
.
path
)
self
.
parser
.
read
(
self
.
path
)
#clean_options(options)
#clean_options(options)
for
key
in
options
:
for
key
in
self
.
options
:
if
key
not
in
self
.
parser
.
options
(
name
):
if
key
not
in
self
.
parser
.
options
(
self
.
name
):
self
.
parser
.
set
(
name
,
key
,
options
[
key
])
self
.
parser
.
set
(
self
.
name
,
key
,
self
.
options
[
key
])
with
open
(
self
.
path
,
'w'
)
as
file
:
with
open
(
self
.
path
,
'w'
)
as
file
:
self
.
parser
.
write
(
file
)
self
.
parser
.
write
(
file
)
# If the file or section do not exist
# If the file or section do not exist
except
ConfigParser
.
NoSectionError
,
IOError
:
except
ConfigParser
.
NoSectionError
,
IOError
:
#clean_options(options)
self
.
full_install
()
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
install
=
update
=
lambda
self
:
[]
install
=
update
=
lambda
self
:
[]
def
full_install
(
self
,
name
,
options
):
def
full_install
(
self
):
self
.
parser
.
add_section
(
name
)
self
.
parser
.
read
(
self
.
path
)
for
key
in
options
:
self
.
parser
.
add_section
(
self
.
name
)
self
.
parser
.
set
(
name
,
key
,
options
[
key
])
for
key
in
self
.
options
:
self
.
parser
.
set
(
self
.
name
,
key
,
self
.
options
[
key
])
with
open
(
self
.
path
,
'w'
)
as
file
:
with
open
(
self
.
path
,
'w'
)
as
file
:
self
.
parser
.
write
(
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