Show More
@@ -1,101 +1,101 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2010-2017 RhodeCode GmbH |
|
3 | # Copyright (C) 2010-2017 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | """ |
|
21 | """ | |
22 | Single source for redirection links. |
|
22 | Single source for redirection links. | |
23 |
|
23 | |||
24 | Goal of this module is to provide a single source of truth regarding external |
|
24 | Goal of this module is to provide a single source of truth regarding external | |
25 | links. The data inside this module is used to configure the routing |
|
25 | links. The data inside this module is used to configure the routing | |
26 | system of Enterprise and it is used also as a base to check if this data |
|
26 | system of Enterprise and it is used also as a base to check if this data | |
27 | and our server configuration are in sync. |
|
27 | and our server configuration are in sync. | |
28 |
|
28 | |||
29 | .. py:data:: link_config |
|
29 | .. py:data:: link_config | |
30 |
|
30 | |||
31 | Contains the configuration for external links. Each item is supposed to be |
|
31 | Contains the configuration for external links. Each item is supposed to be | |
32 | a `dict` like this example:: |
|
32 | a `dict` like this example:: | |
33 |
|
33 | |||
34 | {"name": "url_name", |
|
34 | {"name": "url_name", | |
35 | "target": "https://rhodecode.com/r1/enterprise/keyword/", |
|
35 | "target": "https://rhodecode.com/r1/enterprise/keyword/", | |
36 | "external_target": "https://example.com/some-page.html", |
|
36 | "external_target": "https://example.com/some-page.html", | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | then you can retrieve the url by simply calling the URL function: |
|
39 | then you can retrieve the url by simply calling the URL function: | |
40 |
|
40 | |||
41 | `h.url('url_name')` |
|
41 | `h.url('url_name')` | |
42 |
|
42 | |||
43 | The redirection must be first implemented in our servers before |
|
43 | The redirection must be first implemented in our servers before | |
44 | you can see it working. |
|
44 | you can see it working. | |
45 | """ |
|
45 | """ | |
46 | # flake8: noqa |
|
46 | # flake8: noqa | |
47 | from __future__ import unicode_literals |
|
47 | from __future__ import unicode_literals | |
48 |
|
48 | |||
49 | link_config = [ |
|
49 | link_config = [ | |
50 | { |
|
50 | { | |
51 | "name": "enterprise_docs", |
|
51 | "name": "enterprise_docs", | |
52 | "target": "https://rhodecode.com/r1/enterprise/docs/", |
|
52 | "target": "https://rhodecode.com/r1/enterprise/docs/", | |
53 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/", |
|
53 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/", | |
54 | }, |
|
54 | }, | |
55 | { |
|
55 | { | |
56 | "name": "enterprise_log_file_locations", |
|
56 | "name": "enterprise_log_file_locations", | |
57 | "target": "https://rhodecode.com/r1/enterprise/docs/admin-system-overview/", |
|
57 | "target": "https://rhodecode.com/r1/enterprise/docs/admin-system-overview/", | |
58 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/system-overview.html#log-files", |
|
58 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/system-overview.html#log-files", | |
59 | }, |
|
59 | }, | |
60 | { |
|
60 | { | |
61 | "name": "enterprise_issue_tracker_settings", |
|
61 | "name": "enterprise_issue_tracker_settings", | |
62 | "target": "https://rhodecode.com/r1/enterprise/docs/issue-trackers-overview/", |
|
62 | "target": "https://rhodecode.com/r1/enterprise/docs/issue-trackers-overview/", | |
63 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/issue-trackers/issue-trackers.html", |
|
63 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/issue-trackers/issue-trackers.html", | |
64 | }, |
|
64 | }, | |
65 | { |
|
65 | { | |
66 | "name": "enterprise_svn_setup", |
|
66 | "name": "enterprise_svn_setup", | |
67 | "target": "https://rhodecode.com/r1/enterprise/docs/svn-setup/", |
|
67 | "target": "https://rhodecode.com/r1/enterprise/docs/svn-setup/", | |
68 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/svn-http.html", |
|
68 | "external_target": "https://docs.rhodecode.com/RhodeCode-Enterprise/admin/svn-http.html", | |
69 | }, |
|
69 | }, | |
70 | { |
|
70 | { | |
71 | "name": "rst_help", |
|
71 | "name": "rst_help", | |
72 | "target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html", |
|
72 | "target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html", | |
73 | "external_target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html", |
|
73 | "external_target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html", | |
74 | }, |
|
74 | }, | |
75 | { |
|
75 | { | |
76 | "name": "markdown_help", |
|
76 | "name": "markdown_help", | |
77 | "target": "http://daringfireball.net/projects/markdown/syntax", |
|
77 | "target": "https://daringfireball.net/projects/markdown/syntax", | |
78 | "external_target": "http://daringfireball.net/projects/markdown/syntax", |
|
78 | "external_target": "https://daringfireball.net/projects/markdown/syntax", | |
79 | }, |
|
79 | }, | |
80 | { |
|
80 | { | |
81 | "name": "rhodecode_official", |
|
81 | "name": "rhodecode_official", | |
82 | "target": "https://rhodecode.com", |
|
82 | "target": "https://rhodecode.com", | |
83 | "external_target": "https://rhodecode.com/", |
|
83 | "external_target": "https://rhodecode.com/", | |
84 | }, |
|
84 | }, | |
85 | { |
|
85 | { | |
86 | "name": "rhodecode_support", |
|
86 | "name": "rhodecode_support", | |
87 | "target": "https://rhodecode.com/help/", |
|
87 | "target": "https://rhodecode.com/help/", | |
88 | "external_target": "https://rhodecode.com/support", |
|
88 | "external_target": "https://rhodecode.com/support", | |
89 | }, |
|
89 | }, | |
90 | { |
|
90 | { | |
91 | "name": "rhodecode_translations", |
|
91 | "name": "rhodecode_translations", | |
92 | "target": "https://rhodecode.com/translate/enterprise", |
|
92 | "target": "https://rhodecode.com/translate/enterprise", | |
93 | "external_target": "https://www.transifex.com/rhodecode/RhodeCode/", |
|
93 | "external_target": "https://www.transifex.com/rhodecode/RhodeCode/", | |
94 | }, |
|
94 | }, | |
95 |
|
95 | |||
96 | ] |
|
96 | ] | |
97 |
|
97 | |||
98 |
|
98 | |||
99 | def connect_redirection_links(config): |
|
99 | def connect_redirection_links(config): | |
100 | for link in link_config: |
|
100 | for link in link_config: | |
101 | config.add_route(link['name'], link['target'], static=True) |
|
101 | config.add_route(link['name'], link['target'], static=True) |
General Comments 0
You need to be logged in to leave comments.
Login now