Re: pglister: bug: Can't add moderators (and create lists)

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Célestin Matte <celestin(dot)matte(at)cmatte(dot)me>
Cc: PostgreSQL WWW <pgsql-www(at)lists(dot)postgresql(dot)org>
Subject: Re: pglister: bug: Can't add moderators (and create lists)
Date: 2021-09-21 16:09:37
Message-ID: CABUevEzCd7jAdGskWOta1Tu-QbeFTaRUxo3fdTth0vuadPhsRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

On Tue, Sep 21, 2021 at 12:01 PM Célestin Matte
<celestin(dot)matte(at)cmatte(dot)me> wrote:
>
> > For example, for my local pglister installation I have a mapping for
> > static files of:
> > /media/admin ->
> > /home/mha/django/django22-py3/lib/python3.7/site-packages/django/contrib/admin/static/admin
> >
> > (this being in my virtualenv that holds the django installation)
>
> Oh, so these files are all shipped with django. Thanks, that solves the issue

Yup.

> >> Unrelated issue I encountered when debugging: when activating logging in django, the log file get spammed with exceptions every time django is hitting a {%if somevariable %} syntax, even though that's the correct django way to test variable existence [1]. Any idea what could be causing that?
> >> [1] https://docs.djangoproject.com/en/2.2/ref/templates/builtins/#if
> >
> > That's strange. I don't see any of that. Exactly what does the
> > exception look like?
> >
>
> Example on the main page, with a DEBUG-level logger activated:
> Exception while resolving variable 'title' in template 'home.html'.
> Traceback (most recent call last):
> File "/srv/pglister/local/web/pglister/lib/python3.7/site-packages/django/template/base.py", line 829, in _resolve_lookup
> current = current[bit]
> File "/srv/pglister/local/web/pglister/lib/python3.7/site-packages/django/template/context.py", line 83, in __getitem__
> raise KeyError(key)
> KeyError: 'title'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/srv/pglister/local/web/pglister/lib/python3.7/site-packages/django/template/base.py", line 835, in _resolve_lookup
> if isinstance(current, BaseContext) and getattr(type(current), bit):
> AttributeError: type object 'RequestContext' has no attribute 'title'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/srv/pglister/local/web/pglister/lib/python3.7/site-packages/django/template/base.py", line 843, in _resolve_lookup
> current = current[int(bit)]
> ValueError: invalid literal for int() with base 10: 'title'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/srv/pglister/local/web/pglister/lib/python3.7/site-packages/django/template/base.py", line 850, in _resolve_lookup
> (bit, current)) # missing attribute
> django.template.base.VariableDoesNotExist: Failed lookup for key [title] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x7fa5737bdea0>>, 'request': <WSGIRequest: GET '/'>, 'user': <SimpleLazyObject: <function AuthenticationMiddleware.process_request.<locals>.<lambda> at 0x7fa573832488>>, 'perms': <django.contrib.auth.context_processors.PermWrapper object at 0x7fa5737fc518>, 'messages': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x7fa573800a58>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}}, {}, {'view': <pglister.lists.views.Home object at 0x7fa573800b70>}]
>
>
> This line triggering this is in templates/base.html:
> <title>{%if title%}{{title}} - {%endif%}PostgreSQL mailing lists</title>

Huh, strange.

I'm not seeing this on my local dev, and we're obviously also not
seeing in production or nothing would work. These are both Debian
environments though, python 3.7.3 and django 2.2.24.

--
Magnus Hagander
Me: https://www.hagander.net/
Work: https://www.redpill-linpro.com/

In response to

Browse pgsql-www by date

  From Date Subject
Next Message Joe Conway 2021-09-21 17:53:52 Re: Wiki editor request
Previous Message Mrr Hab 2021-09-21 15:04:05 Wiki editor request