Commit 3d1dc66f authored by Łukasz Nowak's avatar Łukasz Nowak

- improve matching form_id with url by using regular expression


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34405 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a94b35e4
...@@ -595,10 +595,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -595,10 +595,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
# XXX-Luke: As this is not possible to do form_id -> action_id the # 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 # only way to know if form_id is implemented by action of document
# is to use string matching. # is to use string matching.
# Current matching is not perfect - if action url is defined like: # This re will (form_id = Base_view):
# bla/bla/[form_id]?q # qdsqdsq/Base_view --> match
# it will not match. re hacker will be able to improve # qdsqdsq/Base_view?qsdsqd --> matches
if url.endswith(form_id): # 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 form_id
return 'view' return 'view'
......
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