/
config.py
274 lines (263 loc) · 9.58 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
from django.utils.datastructures import SortedDict
from tower import ugettext_lazy as _lazy
# The number of answers per page.
ANSWERS_PER_PAGE = 20
# The number of questions per page.
QUESTIONS_PER_PAGE = 20
# Highest ranking to show for a user
HIGHEST_RANKING = 100
# Special tag names:
ESCALATE_TAG_NAME = 'escalate'
NEEDS_INFO_TAG_NAME = 'needsinfo'
OFFTOPIC_TAG_NAME = 'offtopic'
products = SortedDict([
('desktop', {
'name': _lazy(u'Firefox for Desktop'),
'subtitle': _lazy(u'Windows, Mac, or Linux'),
'extra_fields': ['troubleshooting', 'ff_version', 'os', 'plugins'],
'tags': ['desktop'],
'products': ['firefox'],
'categories': SortedDict([
# TODO: Just use the IA topics for this.
('get-started', {
'name': _lazy(u'Learn the Basics: get started'),
'topic': 'get-started',
'tags': ['get-started'],
}),
('download-and-install', {
'name': _lazy(u'Download, install and migration'),
'topic': 'download-and-install',
'tags': ['download-and-install'],
}),
('privacy-and-security', {
'name': _lazy(u'Privacy and security settings'),
'topic': 'privacy-and-security',
'tags': ['privacy-and-security'],
}),
('customize', {
'name': _lazy(u'Customize controls, options and add-ons'),
'topic': 'customize',
'tags': ['customize'],
}),
('fix-problems', {
'name': _lazy(u'Fix slowness, crashing, error messages and '
u'other problems'),
'topic': 'fix-problems',
'tags': ['fix-problems'],
}),
('tips', {
'name': _lazy(u'Tips and tricks'),
'topic': 'tips',
'tags': ['tips'],
}),
('bookmarks', {
'name': _lazy(u'Bookmarks'),
'topic': 'bookmarks',
'tags': ['bookmarks'],
}),
('cookies', {
'name': _lazy(u'Cookies'),
'topic': 'cookies',
'tags': ['cookies'],
}),
('tabs', {
'name': _lazy(u'Tabs'),
'topic': 'tabs',
'tags': ['tabs'],
}),
('websites', {
'name': _lazy(u'Websites'),
'topic': 'websites',
'tags': ['websites'],
}),
])
}),
('mobile', {
'name': _lazy(u'Firefox for Mobile'),
'subtitle': _lazy(u'Android'),
'extra_fields': ['ff_version', 'os', 'plugins'],
'tags': ['mobile'],
'products': ['mobile'],
'categories': SortedDict([
# TODO: Just use the IA topics for this.
('get-started', {
'name': _lazy(u'Learn the Basics: get started'),
'topic': 'get-started',
'tags': ['get-started'],
}),
('download-and-install', {
'name': _lazy(u'Download, install and migration'),
'topic': 'download-and-install',
'tags': ['download-and-install'],
}),
('privacy-and-security', {
'name': _lazy(u'Privacy and security settings'),
'topic': 'privacy-and-security',
'tags': ['privacy-and-security'],
}),
('customize', {
'name': _lazy(u'Customize controls, options and add-ons'),
'topic': 'customize',
'tags': ['customize'],
}),
('fix-problems', {
'name': _lazy(u'Fix slowness, crashing, error messages and '
u'other problems'),
'topic': 'fix-problems',
'tags': ['fix-problems'],
}),
('tips', {
'name': _lazy(u'Tips and tricks'),
'topic': 'tips',
'tags': ['tips'],
}),
('bookmarks', {
'name': _lazy(u'Bookmarks'),
'topic': 'bookmarks',
'tags': ['bookmarks'],
}),
('cookies', {
'name': _lazy(u'Cookies'),
'topic': 'cookies',
'tags': ['cookies'],
}),
('tabs', {
'name': _lazy(u'Tabs'),
'topic': 'tabs',
'tags': ['tabs'],
}),
('websites', {
'name': _lazy(u'Websites'),
'topic': 'websites',
'tags': ['websites'],
}),
])
}),
('firefox-os', {
'name': _lazy(u'Firefox OS'),
'subtitle': '',
'extra_fields': [],
'tags': [],
'products': ['firefox-os'],
'categories': SortedDict([
# TODO: Just use the IA topics for this.
('download-and-install', {
'name': _lazy(u'Download and install apps'),
'topic': 'marketplace',
'tags': ['marketplace'],
}),
('customize', {
'name': _lazy(u'Customize controls, options, settings and '
u'preferences'),
'topic': 'settings',
'tags': ['settings'],
}),
('fix-problems', {
'name': _lazy(u'Fix slowness, crashing, error messages and '
u'other problems'),
'topic': 'fix-problems',
'tags': ['fix-problems'],
}),
])
}),
('webmaker', {
'name': _lazy(u'Webmaker'),
'subtitle': _lazy('Tools for creating and teaching the web'),
'extra_fields': [],
'tags': [],
'products': ['webmaker'],
'categories': SortedDict([
# TODO: Just use the IA topics for this.
('popcorn-maker', {
'name': _lazy(u'Using Popcorn Maker'),
'topic': 'popcorn-maker',
'tags': ['popcorn-maker'],
}),
('thimble', {
'name': _lazy(u'Using Thimble'),
'topic': 'thimble',
'tags': ['thimble'],
}),
('x-ray-goggles', {
'name': _lazy(u'Using X-Ray Goggles'),
'topic': 'x-ray-goggles',
'tags': ['x-ray-goggles'],
}),
('get-the-most-from-webmaker', {
'name': _lazy(u'Using a feature on webmaker.org'),
'topic': 'get-the-most-from-webmaker',
'tags': ['get-the-most-from-webmaker'],
}),
('events-and-help-for-mentors', {
'name': _lazy(u'Contributing to Webmaker'),
'topic': 'events-and-help-for-mentors',
'tags': ['events-and-help-for-mentors'],
}),
])
}),
('thunderbird', {
'name': _lazy(u'Thunderbird'),
'subtitle': '',
'extra_fields': [],
'tags': [],
'products': ['thunderbird'],
'categories': SortedDict([
('get-started', {
'name': _lazy(u'Learn the Basics: get started'),
'topic': 'learn-basics-get-started',
'tags': ['get-started'],
}),
('download-and-install', {
'name': _lazy(u'Download, install and migration'),
'topic': 'download-install-and-migration',
'tags': ['download-and-install'],
}),
('privacy-and-security', {
'name': _lazy(u'Privacy and security settings'),
'topic': 'privacy-and-security-settings',
'tags': ['privacy-and-security'],
}),
('customize', {
'name': _lazy(u'Customize controls, options and add-ons'),
'topic': 'customize-controls-options-and-add-ons',
'tags': ['customize'],
}),
('fix-problems', {
'name': _lazy(u'Fix slowness, crashing, error messages and '
u'other problems'),
'topic': 'fix-slowness-crashing-error-messages-and-other-'
'problems',
'tags': ['fix-problems'],
}),
('calendar', {
'name': _lazy('Calendar'),
'topic': 'calendar',
'tags': ['calendar'],
})
])
}),
('other', {
'name': _lazy(u'Other Mozilla products'),
'subtitle': '',
'html': 'This site is only provides support for some of our products. '
'For other support, please find your product below.'
'<ul class="product-support">'
'<li><a href="http://www.seamonkey-project.org/doc/">'
'SeaMonkey support</a></li>'
'<li><a href="http://caminobrowser.org/help/">'
'Camino support</a></li>'
'<li><a '
'href="http://www.mozilla.org/projects/calendar/faq.html">'
'Lightning and Sunbird support</a></li>'
'</ul>',
'categories': SortedDict([]),
'deadend': True,
}),
])
def add_backtrack_keys(products):
"""Insert 'key' keys so we can go from product or category back to key."""
for p_k, p_v in products.iteritems():
p_v['key'] = p_k
for c_k, c_v in p_v['categories'].iteritems():
c_v['key'] = c_k
add_backtrack_keys(products)