Compare commits

..

2 Commits

Author SHA1 Message Date
Serghei Mihai 4df0449045 wscalls: preview unflattened payload (#66916)
gitea/wcs/pipeline/head This commit looks good Details
2024-04-03 15:10:49 +02:00
Serghei Mihai 183f886f88 wscalls: unflatten payload when calling webservice (#66916) 2024-04-03 15:02:04 +02:00
2 changed files with 5 additions and 5 deletions

View File

@ -337,9 +337,9 @@ class RootDirectory(Directory):
dump = json.dumps(unflatten_keys(payload), ensure_ascii=False, indent=2)
r += htmltext('<pre>%s</pre>') % dump.replace('"{{', '{{').replace('}}"', '}}')
except UnflattenKeysException as e:
r += htmltext('<div class="errornotice"><p>%s</p><p>%s%s</p></div>') % (
_('Unable to unflatten payload.'),
_('Error message: '),
r += htmltext('<div class="errornotice"><p>%s</p><p>%s<code>%s</code></p></div>') % (
_('Unable to generate payload.'),
_('Following error occured: '),
e,
)
r += htmltext('</div>')

View File

@ -107,8 +107,8 @@ def unflatten_keys(d):
assert isinstance(d, list)
if len(d) < key:
raise UnflattenKeysException(
_('incomplete array before %s in %s') % ('/'.join([str(x) for x in path[: i + 1]])),
orig_key,
_('incomplete array before %s in %s')
% (('/'.join([str(x) for x in path[: i + 1]])), orig_key)
)
if len(d) == key:
d.append(new)