Skip to content

Commit e7eb947

Browse files
committed
include inputlookup and outputlookup
1 parent b24c88d commit e7eb947

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

contentctl/objects/lookup.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,26 +85,19 @@ def fix_lookup_path(cls, data:Any, info: ValidationInfo)->Any:
8585

8686
@staticmethod
8787
def get_lookups(text_field: str, director:DirectorOutputDto, ignore_lookups:set[str]=LOOKUPS_TO_IGNORE)->list[Lookup]:
88+
# Comprehensively match all kinds of lookups, including inputlookup and outputlookup
8889
inputLookupsToGet = set(re.findall(r'inputlookup(?:\s*(?:(?:append|strict|start|max)\s*=\s*(?:true|t|false|f))){0,4}\s+([^\s]+)', text_field))
8990
outputLookupsToGet = set(re.findall(r'outputlookup(?:\s*(?:(?:append|create_empty|override_if_empty|max|key_field|allow_updates|createinapp|create_context|output_format)\s*=\s*[^\s]*))*\s+([^\s]+)',text_field))
90-
# Don't match inputlookup or outputlookup. Allow local=true or update=true or local=t or update=t
91-
lookups_to_get = set(re.findall(r'(?:(?<!output)(?<!input))lookup(?:\s*(?:(?:local|update)\s*=\s*(?:true|t|false|f))){0,2}\s+([^\s]+)', text_field))
92-
#lookups_to_get = set(re.findall(r'[^output]lookup (?:update=true)?(?:append=t)?\s*([^\s]*)', text_field))
93-
#lookups_to_get = set(re.findall(r'(?!output)lookup(?:\s*(?:(?:local|update)\s*=\s*(?:true|t))){0,2}\s+([^\s]+)', text_field))
94-
95-
96-
91+
lookupsToGet = set(re.findall(r'(?:(?<!output)(?<!input))lookup(?:\s*(?:(?:local|update)\s*=\s*(?:true|t|false|f))){0,2}\s+([^\s]+)', text_field))
92+
9793

9894
input_lookups = Lookup.mapNamesToSecurityContentObjects(list(inputLookupsToGet-LOOKUPS_TO_IGNORE), director)
9995
output_lookups = Lookup.mapNamesToSecurityContentObjects(list(outputLookupsToGet-LOOKUPS_TO_IGNORE), director)
100-
101-
102-
103-
my_lookups = Lookup.mapNamesToSecurityContentObjects(list(lookups_to_get-LOOKUPS_TO_IGNORE), director)
96+
lookups = Lookup.mapNamesToSecurityContentObjects(list(lookupsToGet-LOOKUPS_TO_IGNORE), director)
10497

10598

10699

107-
return my_lookups
100+
return lookups + input_lookups + output_lookups
108101

109102

110103

0 commit comments

Comments
 (0)