Commit 0e1d5c6d authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_core: fix naming convention "be triggered on" is invalid

parent d12a8100
...@@ -96,11 +96,13 @@ CLOSED_CLASS_WORD_LIST = """\n ...@@ -96,11 +96,13 @@ CLOSED_CLASS_WORD_LIST = """\n
well what whatever when where whereas whether which while whilst who whoever\n well what whatever when where whereas whether which while whilst who whoever\n
whom whose with within without worth would yes you your yours yourself\n whom whose with within without worth would yes you your yours yourself\n
""".split()\n """.split()\n
CLOSED_CLASS_WORD_LIST += (\n CLOSED_CLASS_WORD_SET = set(CLOSED_CLASS_WORD_LIST)\n
assert len(CLOSED_CLASS_WORD_SET) == len(CLOSED_CLASS_WORD_LIST)\n
SENTENCE_PART_LIST = (\n
"doesn\'t",\n "doesn\'t",\n
\n \n
"according to", "ahead of", "apart from", "as long as", "as opposed to",\n "according to", "ahead of", "apart from", "as long as", "as opposed to",\n
"away from", "by means of", "by way of", "contrary to", "depending on",\n "away from", "be triggered on", "by means of", "by way of", "contrary to", "depending on",\n
"due to", "each other", "even if", "even though", "even when", "given that",\n "due to", "each other", "even if", "even though", "even when", "given that",\n
"in accordance with", "in addition to", "in case", "in charge of",\n "in accordance with", "in addition to", "in case", "in charge of",\n
"in conjunction with", "in connection with", "in favour of", "in front of",\n "in conjunction with", "in connection with", "in favour of", "in front of",\n
...@@ -111,8 +113,8 @@ CLOSED_CLASS_WORD_LIST += (\n ...@@ -111,8 +113,8 @@ CLOSED_CLASS_WORD_LIST += (\n
"provided that", "relative to", "so long as", "subject to", "with regard to",\n "provided that", "relative to", "so long as", "subject to", "with regard to",\n
"with respect to",\n "with respect to",\n
)\n )\n
CLOSED_CLASS_WORD_SET = set(CLOSED_CLASS_WORD_LIST)\n SENTENCE_PART_SET = set(SENTENCE_PART_LIST)\n
assert len(CLOSED_CLASS_WORD_SET) == len(CLOSED_CLASS_WORD_LIST)\n assert len(SENTENCE_PART_SET) == len(SENTENCE_PART_LIST)\n
\n \n
# List of allowed characters, usefull to detect non-english strings\n # List of allowed characters, usefull to detect non-english strings\n
ALLOWED_CHARS = set("abcdefghijklmnopqrstuvwxyz0123456789%/. ()-_?&\'#,;")\n ALLOWED_CHARS = set("abcdefghijklmnopqrstuvwxyz0123456789%/. ()-_?&\'#,;")\n
...@@ -172,6 +174,8 @@ def checkTitle(path, id, title, field=None, form=None):\n ...@@ -172,6 +174,8 @@ def checkTitle(path, id, title, field=None, form=None):\n
for c in title:\n for c in title:\n
if c.lower() not in ALLOWED_CHARS:\n if c.lower() not in ALLOWED_CHARS:\n
return "%s : %s : %r character not allowed\\n" % (path, id, c)\n return "%s : %s : %r character not allowed\\n" % (path, id, c)\n
\n
title = re.sub(re.compile(r"\\b(" + "|".join(re.escape(x) for x in SENTENCE_PART_SET) + r")\\b"), "", title)\n
\n \n
word_list = title.split(\' \')\n word_list = title.split(\' \')\n
for word in word_list:\n for word in word_list:\n
......
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