Using user.is_authenticated() as a method is deprecated
Use is_authenticated as an attribute.
This commit is contained in:
parent
6bd14ee0c9
commit
49bec38981
@ -33,7 +33,7 @@
|
||||
@login_required
|
||||
def index(request):
|
||||
"""The developer dashboard."""
|
||||
if request.user.is_authenticated():
|
||||
if request.user.is_authenticated:
|
||||
inner_q = PackageRelation.objects.filter(user=request.user)
|
||||
else:
|
||||
inner_q = PackageRelation.objects.none()
|
||||
|
@ -28,7 +28,7 @@ def mirrors(request, tier=None):
|
||||
'mirror_id', 'country').order_by(
|
||||
'mirror_id', 'country').distinct()
|
||||
|
||||
if not request.user.is_authenticated():
|
||||
if not request.user.is_authenticated:
|
||||
mirror_list = mirror_list.filter(public=True, active=True)
|
||||
protos = protos.filter(
|
||||
mirror__public=True, mirror__active=True, active=True)
|
||||
@ -52,7 +52,7 @@ def mirrors(request, tier=None):
|
||||
|
||||
def mirror_details(request, name):
|
||||
mirror = get_object_or_404(Mirror, name=name)
|
||||
authorized = request.user.is_authenticated()
|
||||
authorized = request.user.is_authenticated
|
||||
if not authorized and \
|
||||
(not mirror.public or not mirror.active):
|
||||
raise Http404
|
||||
@ -90,7 +90,7 @@ def url_details(request, name, url_id):
|
||||
url = get_object_or_404(MirrorUrl.objects.select_related(),
|
||||
id=url_id, mirror__name=name)
|
||||
mirror = url.mirror
|
||||
authorized = request.user.is_authenticated()
|
||||
authorized = request.user.is_authenticated
|
||||
if not authorized and \
|
||||
(not mirror.public or not mirror.active or not url.active):
|
||||
raise Http404
|
||||
|
@ -87,7 +87,7 @@ def status_json(request, tier=None):
|
||||
|
||||
|
||||
def mirror_details_json(request, name):
|
||||
authorized = request.user.is_authenticated()
|
||||
authorized = request.user.is_authenticated
|
||||
mirror = get_object_or_404(Mirror, name=name)
|
||||
if not authorized and (not mirror.public or not mirror.active):
|
||||
raise Http404
|
||||
|
@ -61,7 +61,7 @@ def flag(request, name, repo, arch):
|
||||
repo__staging=pkg.repo.staging).order_by(
|
||||
'pkgname', 'repo__name', 'arch__name')
|
||||
|
||||
authenticated = request.user.is_authenticated()
|
||||
authenticated = request.user.is_authenticated
|
||||
|
||||
if request.POST:
|
||||
form = FlagForm(request.POST, authenticated=authenticated)
|
||||
|
@ -120,12 +120,12 @@ def get(self, request, *args, **kwargs):
|
||||
if request.method == 'HEAD':
|
||||
return empty_response()
|
||||
self.form = PackageSearchForm(data=request.GET,
|
||||
show_staging=self.request.user.is_authenticated())
|
||||
show_staging=self.request.user.is_authenticated)
|
||||
return super(SearchListView, self).get(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
packages = Package.objects.normal()
|
||||
if not self.request.user.is_authenticated():
|
||||
if not self.request.user.is_authenticated:
|
||||
packages = packages.filter(repo__staging=False)
|
||||
if self.form.is_valid():
|
||||
packages = parse_form(self.form, packages)
|
||||
@ -160,7 +160,7 @@ def search_json(request):
|
||||
|
||||
if request.GET:
|
||||
form = PackageSearchForm(data=request.GET,
|
||||
show_staging=request.user.is_authenticated())
|
||||
show_staging=request.user.is_authenticated)
|
||||
if form.is_valid():
|
||||
form_limit = form.cleaned_data['limit']
|
||||
limit = min(limit, int(form_limit)) if form_limit else limit
|
||||
@ -168,7 +168,7 @@ def search_json(request):
|
||||
|
||||
packages = Package.objects.select_related('arch', 'repo',
|
||||
'packager')
|
||||
if not request.user.is_authenticated():
|
||||
if not request.user.is_authenticated:
|
||||
packages = packages.filter(repo__staging=False)
|
||||
packages = parse_form(form, packages)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user