This repository has been archived by the owner on Jan 31, 2019. It is now read-only.
forked from fwenzel/reporter
/
__init__.py
211 lines (169 loc) · 6.05 KB
/
__init__.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
from product_details import product_details
from product_details.version_compare import version_list
from tower import ugettext_lazy as _
## Known manufacturers and devices for mobile feedback.
KNOWN_MANUFACTURERS = (
'Dell Inc.', 'HTC', 'LogicPD', 'Motorola', 'Nokia', 'Nokia', 'samsung',
'SHARP', 'Sony Ericsson', 'TOSHIBA',
)
KNOWN_DEVICES = (
'ADR6300', 'Dell Streak', 'Desire HD', 'Droid', 'DROID2', 'DROID2 GLOBAL',
'DROIDX', 'GT-I9000', 'GT-I9000M', 'GT-I9000T', 'GT-P1000', 'GT-P1000L',
'GT-P1000M', 'GT-P1000R', 'HD2 T8585', 'HTC bravo', 'HTC Desire',
'HTC Glacier', 'HTC HD2', 'HTC Vision', 'IS03', 'LogicPD Zoom2', 'MB520',
'MB860', 'Milestone', 'Nexus One', 'Nexus S', 'Nokia N900', 'PC36100',
'SAMSUNG-SGH-I897', 'SC-01C', 'SC-02B', 'SCH-I500', 'SCH-I800', 'SGH-T849',
'SGH-T959', 'SGH-T959D', 'SHW-M110S', 'SHW-M180S', 'SO-01B', 'SPH-D700',
'SPH-P100', 'T-Mobile G2', 'TOSHIBA_FOLIO_AND_A', 'VEGAn-TAB-v1.0.0b4',
'X10i',
)
## Opinion Type Length Restrictions
MAX_FEEDBACK_LENGTH = 140
MAX_IDEA_LENGTH = 250
## Opinion Types
class OPINION_PRAISE:
id = 1
short = 'praise'
pretty = _(u'Praise')
max_length = MAX_FEEDBACK_LENGTH
class OPINION_ISSUE:
id = 2
short = 'issue'
pretty = _(u'Issue')
max_length = MAX_FEEDBACK_LENGTH
class OPINION_IDEA:
id = 3
short = 'idea'
pretty = _(u'Idea')
max_length = MAX_IDEA_LENGTH
class OPINION_RATING:
id = 4
short = 'rating'
pretty = _(u'Rating')
max_length = MAX_FEEDBACK_LENGTH
class OPINION_BROKEN:
id = 5
short = 'brokenwebsite'
pretty = _(u'Broken Website')
max_length = MAX_FEEDBACK_LENGTH
op_types = {
'OPINION_PRAISE': OPINION_PRAISE,
'OPINION_ISSUE': OPINION_ISSUE,
'OPINION_IDEA': OPINION_IDEA,
}
OPINION_TYPES_USAGE = OPINION_PRAISE, OPINION_ISSUE, OPINION_IDEA
OPINION_TYPES = dict((type.id, type) for type in OPINION_TYPES_USAGE)
## Applications
class FIREFOX:
id = 1
short = 'firefox'
pretty = _(u'Firefox')
guid = '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}'
extra_versions = ['7.0a1', '6.0a2', '6.0a1', '5.0a2', '5.0']
default_version = '5.0' # Default dashboard version.
beta_versions = version_list(
dict(product_details.firefox_history_major_releases.items() +
product_details.firefox_history_stability_releases.items() +
product_details.firefox_history_development_releases.items()),
hide_below='4.0b12',
filter=(lambda v: v.is_beta)
)
release_versions = version_list(
dict(product_details.firefox_history_major_releases.items() +
product_details.firefox_history_stability_releases.items() +
product_details.firefox_history_development_releases.items()),
hide_below='4.0',
filter=(lambda v: v.is_release)
)
class MOBILE:
id = 60
short = 'mobile'
pretty = _(u'Mobile')
guid = '{a23983c0-fd0e-11dc-95ff-0800200c9a66}'
extra_versions = ['7.0a1', '6.0a2', '6.0a1', '5.0a2', '5.0']
default_version = '5.0'
beta_versions = version_list(
dict(product_details.mobile_history_major_releases.items() +
product_details.mobile_history_stability_releases.items() +
product_details.mobile_history_development_releases.items()),
hide_below='4.0b1',
filter=(lambda v: v.is_beta)
)
release_versions = version_list(
dict(product_details.mobile_history_major_releases.items() +
product_details.mobile_history_stability_releases.items() +
product_details.mobile_history_development_releases.items()),
hide_below='4.0',
filter=(lambda v: v.is_release)
)
PRODUCT_USAGE = _prods = (FIREFOX, MOBILE)
PRODUCTS = dict((prod.short, prod) for prod in _prods)
PRODUCT_IDS = dict((prod.id, prod) for prod in _prods)
UA_PATTERN_FIREFOX = (
r'^Mozilla.*(Firefox|Minefield|Namoroka|Shiretoko|GranParadiso|BonEcho|'
'Iceweasel|Fennec|MozillaDeveloperPreview)\/([^\s]*).*$')
UA_PATTERN_MOBILE = r'^Mozilla.*(Fennec)\/([^\s]*)$'
# Order is important: Since Fennec is Firefox too, it'll match the second
# pattern as well, so we must detect it first.
BROWSERS = (
(MOBILE, UA_PATTERN_MOBILE),
(FIREFOX, UA_PATTERN_FIREFOX),
)
key = 'LATEST_FIREFOX_RELEASED_DEVEL_VERSION'
LATEST_BETAS = {
FIREFOX: (FIREFOX.beta_versions[0] if FIREFOX.beta_versions else
product_details.firefox_versions[key]),
MOBILE: (MOBILE.beta_versions[0] if MOBILE.beta_versions else
product_details.mobile_details['beta_version']),
}
LATEST_RELEASE = {
FIREFOX: (FIREFOX.release_versions[0] if FIREFOX.release_versions else
product_details.firefox_versions['LATEST_FIREFOX_VERSION']),
MOBILE: (MOBILE.release_versions[0] if MOBILE.release_versions else
product_details.mobile_details['version']),
}
# Operating Systems
class WINDOWS_XP:
pretty = _(u'Windows XP')
short = 'winxp'
ua_pattern = 'Windows NT 5.1'
prods = set((FIREFOX,))
class WINDOWS_7:
pretty = _(u'Windows 7')
short = 'win7'
ua_pattern = 'Windows NT 6.1'
prods = set((FIREFOX,))
class WINDOWS_VISTA:
pretty = _(u'Windows Vista')
short = 'vista'
ua_pattern = 'Windows NT 6.0'
prods = set((FIREFOX,))
class OSX:
pretty = _(u'Mac OS X')
short = 'mac'
ua_pattern = 'Mac'
prods = set((FIREFOX,))
class MAEMO:
pretty = _('Maemo')
short = 'maemo'
ua_pattern = 'Maemo'
prods = set((MOBILE,))
class ANDROID:
pretty = _('Android')
short = 'android'
ua_pattern = 'Android'
prods = set((MOBILE,))
class LINUX:
pretty = _(u'Linux')
short = 'linux'
ua_pattern = 'Linux'
prods = set((FIREFOX,))
class PLATFORM_OTHER:
pretty = _(u'Other')
short = 'other'
ua_pattern = None
prods = set((FIREFOX, MOBILE))
PLATFORM_USAGE = _platforms = (WINDOWS_XP, WINDOWS_VISTA, WINDOWS_7, OSX,
MAEMO, ANDROID, LINUX)
PLATFORM_PATTERNS = [(p.ua_pattern, p.short) for p in PLATFORM_USAGE]
PLATFORMS = dict((platform.short, platform) for platform in _platforms)