Skip to content

Commit

Permalink
Setting allows items mapped from system databases.
Browse files Browse the repository at this point in the history
  • Loading branch information
gertjanklein committed Jul 6, 2020
1 parent 17451b8 commit 8cc0bcc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 10 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def get_config(cfgfile):
# Create regexes where needed
config.itemsrx, config.types = get_specs(config.Project.items)
config.lookuprx = get_lookup_specs(config.Project.lookup)
check_default(config.Project, 'mapped', False)

# Determine various directories
local = config.Local
Expand Down Expand Up @@ -101,6 +102,15 @@ def determine_dir(input, default, basedir, tpl):
return result


def check_default(section:Namespace, name:str, default) -> bool:
""" Checks if a value is present, setting default if not """

value = section._get(name)
if value is None or value == '':
section[name] = default
return True
return False

# =====

def main(cfgfile):
Expand Down
5 changes: 2 additions & 3 deletions copy-iris-items.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,10 @@ def get_items_for_type(config, itemtype):
def extract_items(config, result, items):
""" Extract items from service call result and store in list. """

mapped = config.Project.mapped
for db in result:
# Skip stuff coming from system databases
if db.get('dbsys', False): continue
# HSCUSTOM is not marked system, but we'll skip it as well
if db['dbname'] == 'HSCUSTOM': continue
if not mapped and db.get('dbsys', False): continue
# Check items ('docs') in this DB
for doc in db['docs']:
# Skip generated and deployed documents
Expand Down
5 changes: 5 additions & 0 deletions template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ https = false
items = [
]

# Normally, items marked as mapped from system databases are skipped when
# looking for items to load. When this flag is true, mapped system items
# will be included as well, if they match on of the specifications.
mapped = false

# Ensemble Data Lookup Tables to include. Will be saved as the name of
# the table with a ".lut" extension. The lookup table name can have,
# but does not require, a '.lut' extension. Wildcards as with items are
Expand Down

0 comments on commit 8cc0bcc

Please sign in to comment.