Skip to content

Commit d2b9b62

Browse files
benjaminleightonjeremyh
authored andcommitted
Assume settings.env.py defines a python list of tuples
1 parent 213bb51 commit d2b9b62

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,11 @@ You can alter default [Flask](http://flask.pocoo.org/docs/1.0/config/) or
129129
# Default product to display (picks first available)
130130
CUBEDASH_DEFAULT_PRODUCTS = ('ls8_nbar_albers', 'ls7_nbar_albers')
131131

132-
# Limited regex syntax to match product names with a user-defined group.
133-
# Pairs of regex,group are ";" separated. Regex and group are "," separated.
134-
# As such ";" and "," can't be used in the regexs.
135-
# eg ".albers., Albers projection; level1, Level 1 products"
132+
# CUBEDASH_PRODUCT_GROUP_BY_REGEX is a list of tuples of (regex_pattern_string,group_name)
136133
# If re.search(regex, product name) then return the corresponding group.
137134
# If CUBEDASH_PRODUCT_GROUP_BY_REGEX string parses then regex matching will be used in place of CUBEDASH_PRODUCT_GROUP_BY_FIELD.
138135
# If CUBEDASH_PRODUCT_GROUP_BY_REGEX string is malformed an error will be logged and we default back to CUBEDASH_PRODUCT_GROUP_BY_FIELD.
139-
# eg ".*albers.*,Albers projection;level1,Level 1 products"
136+
# eg "[('.*albers.*','Albers projection'), ('.*level1.*','Level 1 products'), ('.*usgs.*','Level 1 products')]"
140137
CUBEDASH_PRODUCT_GROUP_BY_REGEX = None
141138
# Which field should we use when grouping products in the top menu?
142139
CUBEDASH_PRODUCT_GROUP_BY_FIELD = 'product_type'

cubedash/_pages.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,8 @@ def _get_grouped_products() -> List[Tuple[str, List[ProductWithSummary]]]:
281281
if group_by_regex:
282282
try:
283283
regex_group= {}
284-
for regex_group_pair in group_by_regex.split(';'):
285-
regex, group = regex_group_pair.split(',')
286-
regex_group[re.compile(regex.strip())] = group.strip()
284+
for regex, group in group_by_regex:
285+
regex_group[re.compile(regex.strip())] = group.strip()
287286
except Exception as e:
288287
_LOG.warn("invalid CUBEDASH_PRODUCT_GROUP_BY_REGEX: {}".format(group_by_regex))
289288
group_by_regex = None

0 commit comments

Comments
 (0)