#32894: isinstance(LazyConfig, str) raises Excepion
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
hiaselhans |
Type: | Status: new
Uncategorized |
Component: Core | Version: 3.2
(Other) | Keywords: lazyobject
Severity: Normal | lazysettings
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
steps to reproduce:
{{{
import django.conf
settings = django.conf.LazySettings()
isinstance(settings, dict)
---------------------------------------------------------------------------
ImproperlyConfigured Traceback (most recent call
last)
<ipython-input-36-201b302c2983> in <module>
2
3 settings = django.conf.LazySettings()
----> 4 isinstance(settings, str)
~/.local/lib/python3.9/site-packages/django/utils/functional.py in
inner(self, *args)
244 def inner(self, *args):
245 if self._wrapped is empty:
--> 246 self._setup()
247 return func(self._wrapped, *args)
248 return inner
~/.local/lib/python3.9/site-packages/django/conf/__init__.py in
_setup(self, name)
61 if not settings_module:
62 desc = ("setting %s" % name) if name else "settings"
---> 63 raise ImproperlyConfigured(
64 "Requested %s, but settings are not configured. "
65 "You must either define the environment variable
%s "
ImproperlyConfigured: Requested settings, but settings are not configured.
You must either define the environment variable DJANGO_SETTINGS_MODULE or
call settings.configure() before accessing settings.
}}}
isinstance is accessing __class__ which wants to setup the lazyobject
maybe __class__ should fall back to returning the "LazyObject"
--
Ticket URL: <https://code.djangoproject.com/ticket/32894>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.9f26e7f6ca6e5f021969a98768c392fc%40djangoproject.com.