You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/12/08 12:32:40 UTC
[6/9] allura git commit: [#8023] ticket:868 Added check mathing url
with page_regex and tool_name with page_tool_type
[#8023] ticket:868 Added check mathing url with page_regex and tool_name with page_tool_type
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/aeabb990
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/aeabb990
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/aeabb990
Branch: refs/heads/ib/8023a
Commit: aeabb9905a3659ab88dee9193ad58544a6a1726e
Parents: c8f14a1
Author: Denis Kotov <de...@gmail.com>
Authored: Fri Dec 4 15:57:21 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Dec 7 10:28:26 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/plugin.py | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/aeabb990/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 2daf8ee..43cc98f 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -1324,6 +1324,14 @@ class ThemeProvider(object):
only_user_project = projects.count() == 1 and projects.first().is_user_project
if projects.count() == 0 or only_user_project:
return None
+ tool_matching = False
+ url_matching = False
+ if note.page_tool_type is None or c.app is not None and c.app.config.tool_name.lower() == note.page_tool_type.lower():
+ tool_matching = True
+ if note.page_regex is None or re.search(note.page_regex, request.url):
+ tool_matching = True
+ if not tool_matching and not url_matching:
+ return None
cookie = request.cookies.get('site-notification', '').split('-')
if len(cookie) == 3 and cookie[0] == str(note._id):
views = asint(cookie[1]) + 1