Show More
@@ -1,106 +1,106 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2010-2019 RhodeCode GmbH |
|
3 | # Copyright (C) 2010-2019 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.route_path('url_name')` |
|
41 | `h.route_path('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 | # pragma: no cover |
|
46 | # pragma: no cover | |
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": "enterprise_license_convert_from_old", |
|
71 | "name": "enterprise_license_convert_from_old", | |
72 | "target": "https://rhodecode.com/r1/enterprise/convert-license/", |
|
72 | "target": "https://rhodecode.com/r1/enterprise/convert-license/", | |
73 | "external_target": "https://rhodecode.com/u/license-upgrade", |
|
73 | "external_target": "https://rhodecode.com/u/license-upgrade", | |
74 | }, |
|
74 | }, | |
75 | { |
|
75 | { | |
76 | "name": "rst_help", |
|
76 | "name": "rst_help", | |
77 | "target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html", |
|
77 | "target": "http://docutils.sourceforge.net/docs/user/rst/quickref.html", | |
78 | "external_target": "http://docutils.sourceforge.io/docs/user/rst/quickref.html", |
|
78 | "external_target": "https://docutils.sourceforge.io/docs/user/rst/quickref.html", | |
79 | }, |
|
79 | }, | |
80 | { |
|
80 | { | |
81 | "name": "markdown_help", |
|
81 | "name": "markdown_help", | |
82 | "target": "https://daringfireball.net/projects/markdown/syntax", |
|
82 | "target": "https://daringfireball.net/projects/markdown/syntax", | |
83 | "external_target": "https://daringfireball.net/projects/markdown/syntax", |
|
83 | "external_target": "https://daringfireball.net/projects/markdown/syntax", | |
84 | }, |
|
84 | }, | |
85 | { |
|
85 | { | |
86 | "name": "rhodecode_official", |
|
86 | "name": "rhodecode_official", | |
87 | "target": "https://rhodecode.com", |
|
87 | "target": "https://rhodecode.com", | |
88 | "external_target": "https://rhodecode.com/", |
|
88 | "external_target": "https://rhodecode.com/", | |
89 | }, |
|
89 | }, | |
90 | { |
|
90 | { | |
91 | "name": "rhodecode_support", |
|
91 | "name": "rhodecode_support", | |
92 | "target": "https://rhodecode.com/help/", |
|
92 | "target": "https://rhodecode.com/help/", | |
93 | "external_target": "https://rhodecode.com/support", |
|
93 | "external_target": "https://rhodecode.com/support", | |
94 | }, |
|
94 | }, | |
95 | { |
|
95 | { | |
96 | "name": "rhodecode_translations", |
|
96 | "name": "rhodecode_translations", | |
97 | "target": "https://rhodecode.com/translate/enterprise", |
|
97 | "target": "https://rhodecode.com/translate/enterprise", | |
98 | "external_target": "https://www.transifex.com/rhodecode/RhodeCode/", |
|
98 | "external_target": "https://www.transifex.com/rhodecode/RhodeCode/", | |
99 | }, |
|
99 | }, | |
100 |
|
100 | |||
101 | ] |
|
101 | ] | |
102 |
|
102 | |||
103 |
|
103 | |||
104 | def connect_redirection_links(config): |
|
104 | def connect_redirection_links(config): | |
105 | for link in link_config: |
|
105 | for link in link_config: | |
106 | config.add_route(link['name'], link['target'], static=True) |
|
106 | config.add_route(link['name'], link['target'], static=True) |
General Comments 0
You need to be logged in to leave comments.
Login now