Commit 26187d69 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

escape '_' in like expression, that means '.' in regexp.

parent 237e7381
......@@ -716,7 +716,7 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
catalog_simulation_movement_list = portal_catalog(
portal_type='Simulation Movement',
causality_uid=[p.getUid() for p in remaining_path_set],
path='%s/%%' % self.getPath())
path='%s/%%' % self.getPath().replace('_', r'\_'))
for movement in catalog_simulation_movement_list:
path = movement.getCausalityValue()
......
......@@ -137,7 +137,7 @@ class ExplanationCache:
if not isinstance(value, dict):
# We have a real root
result.append('%s/%s' % (prefix, key))
result.append('%s/%s/%%' % (prefix, key))
result.append(('%s/%s/%%' % (prefix, key)).replace('_', r'\_'))
# XXX-JPS here we must add all parent movements XXX-JPS
else:
browsePathDict('%s/%s' % (prefix, key), value) # Recursing with string append is slow XXX-JPS
......@@ -262,7 +262,7 @@ class ExplanationCache:
if simulation_path.startswith(path):
# Only keep a path pattern which matches current simulation movement
path_set.add(path)
path_set.add("%s/%%" % path)
path_set.add("%s/%%" % path.replace('_', r'\_'))
# Lookup in cache based on path_tuple
path_tuple = tuple(path_set) # XXX-JPS is the order guaranteed here ?
......
......@@ -58,7 +58,7 @@ follow_up_related_document_list = portal_catalog(\n
portal_type=portal_type,\n
follow_up_uid=context.getUid(), **kw)\n
\n
kw[\'query\'] = Query(relative_url=\'%s/%%\' % context.getRelativeUrl())\n
kw[\'query\'] = Query(relative_url=\'%s/%%\' % context.getRelativeUrl().replace(\'_\', r\'\\_\'))\n
if follow_up_related_document_list:\n
kw[\'query\'] = ComplexQuery(\n
kw[\'query\'],\n
......
41041
\ No newline at end of file
41042
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment