Project

General

Profile

« Previous | Next » 

Revision f8dedf60

Added by koszko about 1 year ago

allow eval() in injected scripts

View differences:

test/haketilo_test/world_wide_library.py
152 152
    'id_suffix':         'a-w-required-mapping-v1',
153 153
    'files_count':       1,
154 154
    'dependencies':      [],
155
    'required_mappings': [{'identifier': 'mapping-a'}]
155
    'required_mappings': [{'identifier': 'mapping-a'}],
156
    'include_in_query':  False
156 157
})
157 158

  
158 159
sample_resource_templates.append({
......
160 161
    'files_count':       1,
161 162
    'dependencies':      [],
162 163
    'required_mappings': [{'identifier': 'mapping-a'}],
163
    'schema_ver':        '2'
164
    'schema_ver':        '2',
165
    'include_in_query':  False
164 166
})
165 167

  
166 168
sample_resources_catalog = {}
......
193 195

  
194 196
    sufs = [srt["id_suffix"], *[l for l in srt["id_suffix"] if l.isalpha()]]
195 197
    patterns = [f'https://example_{suf}.com/*' for suf in set(sufs)]
196
    payloads = {}
198
    mapping['payloads'] = {}
197 199

  
198 200
    for pat in patterns:
199
        payloads[pat] = {'identifier': resource['identifier']}
201
        mapping['payloads'][pat] = {'identifier': resource['identifier']}
200 202

  
201
        queryable_url = pat.replace('*', 'something')
202
        if queryable_url not in sample_queries:
203
            sample_queries[queryable_url] = []
203
        if not srt.get('include_in_query', True):
204
            continue
204 205

  
205
        sample_queries[queryable_url].append({
206
        sample_queries.setdefault(pat.replace('*', 'something'), []).append({
206 207
            'identifier': mapping['identifier'],
207 208
            'long_name':  mapping['long_name'],
208 209
            'version':    mapping_versions[1]
209 210
        })
210 211

  
211
    mapping['payloads'] = payloads
212

  
213 212
    for item in resource, mapping:
214 213
        if 'required_mappings' in srt:
215 214
            item['required_mappings'] = srt['required_mappings']

Also available in: Unified diff