add SANDBOX_PANIC
This commit is contained in:
Родитель
f32b1ff7ef
Коммит
bcb77ea661
|
@ -9,6 +9,7 @@
|
|||
{% endfor %}
|
||||
{% if show_unreviewed %}
|
||||
<li class="perpage">
|
||||
{% if not settings.SANDBOX_PANIC %}
|
||||
<form action="" method="get" class="go">
|
||||
<input type="hidden" name="sort" value="{{ selected }}">
|
||||
<label>
|
||||
|
@ -18,6 +19,7 @@
|
|||
</label>
|
||||
<button type="submit">{{ _('Go') }}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
|
@ -42,6 +42,10 @@ def author_addon_clicked(f):
|
|||
def addon_detail(request, addon_id):
|
||||
"""Add-ons details page dispatcher."""
|
||||
addon = get_object_or_404(Addon.objects.valid(), id=addon_id)
|
||||
|
||||
if settings.SANDBOX_PANIC and addon.status in amo.UNREVIEWED_STATUSES:
|
||||
raise http.Http404
|
||||
|
||||
# addon needs to have a version and be valid for this app.
|
||||
if addon.type in request.APP.types:
|
||||
if addon.type == amo.ADDON_PERSONA:
|
||||
|
|
|
@ -2,6 +2,7 @@ import collections
|
|||
import itertools
|
||||
|
||||
from django import http
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponsePermanentRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
@ -139,7 +140,11 @@ def _listing(request, addon_type, default='popular'):
|
|||
# Set up the queryset and filtering for themes & extension listing pages.
|
||||
status = [amo.STATUS_PUBLIC]
|
||||
|
||||
unreviewed = 'on' if request.GET.get('unreviewed', False) else None
|
||||
if request.GET.get('unreviewed', False) and not settings.SANDBOX_PANIC:
|
||||
unreviewed = 'on'
|
||||
else:
|
||||
unreviewed = None
|
||||
|
||||
if unreviewed:
|
||||
status.append(amo.STATUS_UNREVIEWED)
|
||||
|
||||
|
|
|
@ -77,7 +77,11 @@ def extract_filters(term, kwargs):
|
|||
excludes['num_files'] = 0
|
||||
|
||||
# STATUS_DISABLED and 0 (which likely means null) are filtered
|
||||
excludes['addon_status'] = (0, amo.STATUS_DISABLED,)
|
||||
excludes['addon_status'] = (amo.STATUS_NULL, amo.STATUS_DISABLED,)
|
||||
|
||||
if settings.SANDBOX_PANIC:
|
||||
excludes['addon_status'] = (excludes['addon_status'] +
|
||||
amo.UNREVIEWED_STATUSES)
|
||||
|
||||
if 'before' in kwargs:
|
||||
ranges['modified'] = (kwargs['before'], THE_FUTURE)
|
||||
|
|
|
@ -485,6 +485,9 @@ LOGGING = {
|
|||
},
|
||||
}
|
||||
|
||||
# If you don't want experimental add-ons to show up in any search results or
|
||||
# have detail pages, flip this switch
|
||||
SANDBOX_PANIC = False
|
||||
|
||||
# Read-only mode setup.
|
||||
READ_ONLY = False
|
||||
|
|
Загрузка…
Ссылка в новой задаче