Skip to content

Commit

Permalink
Factorize the config methods in the new extconfig module
Browse files Browse the repository at this point in the history
And don't display inheritance kw property if the config file does not
support a DEFAULT section.
  • Loading branch information
cvaroqui committed Dec 30, 2017
1 parent 2e69b54 commit 72766b5
Show file tree
Hide file tree
Showing 44 changed files with 1,035 additions and 1,893 deletions.
1,001 changes: 1,001 additions & 0 deletions lib/extconfig.py

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions lib/keywords.py
Expand Up @@ -100,7 +100,8 @@ def template_text(self):
s += "# required: %s\n"%str(self.required)
s += "# provisioning: %s\n"%str(self.provisioning)
s += "# default: %s\n"%str(self.default_text)
s += "# inheritance: %s\n"%str(self.inheritance)
if self.top.has_default_section:
s += "# inheritance: %s\n"%str(self.inheritance)
s += "# scope order: %s\n"%str(self.scope_order)
if self.candidates:
s += "# candidates: %s\n"%candidates
Expand Down Expand Up @@ -146,7 +147,8 @@ def template_rst(self, section=None):
s += "**required** %s\n"%str(self.required)
s += "**provisioning** %s\n"%str(self.provisioning)
s += "**default** %s\n"%str(self.default_text)
s += "**inheritance** %s\n"%str(self.inheritance)
if self.top.has_default_section:
s += "**inheritance** %s\n"%str(self.inheritance)
s += "**scope order** %s\n"%str(self.scope_order)
if self.candidates:
s += "**candidates** %s\n"%candidates
Expand Down Expand Up @@ -404,13 +406,14 @@ def getkey(self, keyword, rtype=None):

class KeywordStore(dict):
def __init__(self, provision=False, deprecated_keywords={}, deprecated_sections={},
template_prefix="template.", base_sections=[]):
template_prefix="template.", base_sections=[], has_default_section=True):
self.sections = {}
self.deprecated_sections = deprecated_sections
self.deprecated_keywords = deprecated_keywords
self.template_prefix = template_prefix
self.base_sections = base_sections
self.provision = provision
self.has_default_section = has_default_section

def __iadd__(self, o):
if not isinstance(o, Keyword):
Expand Down

0 comments on commit 72766b5

Please sign in to comment.