diff --git a/product/ERP5Form/Tool/SelectionTool.py b/product/ERP5Form/Tool/SelectionTool.py index ea9ced3be8c9d158c8a1a659ea56b0f014dca929..bf42737fe24c6fbd4583c956587263e7e26d294d 100644 --- a/product/ERP5Form/Tool/SelectionTool.py +++ b/product/ERP5Form/Tool/SelectionTool.py @@ -595,10 +595,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): # XXX-Luke: As this is not possible to do form_id -> action_id the # only way to know if form_id is implemented by action of document # is to use string matching. - # Current matching is not perfect - if action url is defined like: - # bla/bla/[form_id]?q - # it will not match. re hacker will be able to improve - if url.endswith(form_id): + # This re will (form_id = Base_view): + # qdsqdsq/Base_view --> match + # qdsqdsq/Base_view?qsdsqd --> matches + # qdsqdsq/Base_view/qsdsqd --> matches + # qdsqdsq/Base_viewAaa --> doesn't match + # qdsqdsq/Umpa_view --> doesn't match + if re.search('/%s($|\W+)' % form_id, url): return form_id return 'view'