Skip to content
This repository has been archived by the owner on Feb 1, 2018. It is now read-only.

Commit

Permalink
Merge pull request #404 from AdrianGaudebert/888792-backwards-compati…
Browse files Browse the repository at this point in the history
…bility-search

Fixes bug 888792 - Ensured backwards compatibility for plugin_type and h...
  • Loading branch information
adngdb committed Jul 3, 2013
2 parents 932e7a8 + 08a2c13 commit b4da0e0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crashstats/crashstats/templates/crashstats/query.html
Expand Up @@ -94,7 +94,7 @@ <h2>Uh oh! Something went wrong...</h2>
<span class="label">Report Process:</span>
<span class="radio-item">
<label>
<input type="radio" name="process_type" value="any" {% if params.process_type == 'any' %} checked{% endif %}>
<input type="radio" name="process_type" value="any"{% if params.process_type == 'any' %} checked{% endif %}>
Any
</label>
</span>
Expand Down
12 changes: 12 additions & 0 deletions crashstats/crashstats/tests/test_views.py
Expand Up @@ -1488,6 +1488,7 @@ def mocked_get(url, **options):
ok_('nsASDOMWindowEnumerator::GetNext()' in response.content)

# Test that old query types are changed
# Test that plugin data is displayed
response = self.client.get(url, {
'do_query': 1,
'product': 'SeaMonkey',
Expand All @@ -1503,6 +1504,17 @@ def mocked_get(url, **options):
ok_('addon.dll' in response.content)
ok_('superAddOn 1.2.3' in response.content)

# Test 'all' is an accepted value for report_type and hang_type
response = self.client.get(url, {
'do_query': 1,
'product': 'Firefox',
'hang_type': 'all',
'process_type': 'all',
})
eq_(response.status_code, 200)
ok_('table id="signatureList"' in response.content)
ok_('value="any" checked' in response.content)

# Test defaut date
expected = datetime.datetime.utcnow()
response = self.client.get(url)
Expand Down
11 changes: 5 additions & 6 deletions crashstats/crashstats/views.py
Expand Up @@ -1263,14 +1263,13 @@ def query(request, default_context=None):
else:
range_unit = settings.RANGE_UNITS[0]

if form.cleaned_data['process_type']:
process_type = form.cleaned_data['process_type']
else:
# 'all' is here for backwards compatibility, it's an alias of 'any'
process_type = form.cleaned_data['process_type']
if not process_type or process_type == 'all':
process_type = settings.PROCESS_TYPES[0]

if form.cleaned_data['hang_type']:
hang_type = form.cleaned_data['hang_type']
else:
hang_type = form.cleaned_data['hang_type']
if not hang_type or hang_type == 'all':
hang_type = settings.HANG_TYPES[0]

if form.cleaned_data['plugin_field']:
Expand Down
12 changes: 7 additions & 5 deletions crashstats/settings/base.py
Expand Up @@ -194,7 +194,7 @@
# This is for backward compatibility with the PHP app.
QUERY_TYPES_MAP = {
'exact': 'is_exactly',
'startswith': 'starts_with'
'startswith': 'starts_with',
}

# Maximum and default range of query that can be run in search
Expand All @@ -205,28 +205,30 @@
RANGE_UNITS = (
'weeks',
'days',
'hours'
'hours',
)

# process types to allow in queries
PROCESS_TYPES = (
'any',
'browser',
'plugin',
'content'
'content',
'all', # alias for 'any'
)

# hang types to allow in queries
HANG_TYPES = (
'any',
'crash',
'hang-p'
'hang-p',
'all', # alias for 'any'
)

# plugin fields to allow in queries
PLUGIN_FIELDS = (
'filename',
'name'
'name',
)

# this is the max length of signatures in forms
Expand Down

0 comments on commit b4da0e0

Please sign in to comment.