#35141: CACHE_MIDDLEWARE_SECONDS can be set to a float but has to be an int
-------------------------------------+-------------------------------------
     Reporter:  Alexander Lazarević  |                    Owner:  Alexander
         Type:                       |  Lazarević
  Cleanup/optimization               |                   Status:  assigned
    Component:  Core (Cache system)  |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Alexander Lazarević):

 > I'm not sure we want to go down the path of casting every integer
 setting?

 Maybe this could be part of the system checks? Here as an example only for
 one setting, but could be extended to more settings as well.

 {{{
 @register(Tags.files)
 def check_settings_types(app_configs, **kwargs):
     setting = getattr(settings, "CACHE_MIDDLEWARE_SECONDS", None)
     if setting and not isinstance(setting, int):
         return [
             Error(
                 "The CACHE_MIDDLEWARE_SECONDS setting should be an
 integer.",
                 id="files.E002",
             )
         ]
     return []
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35141#comment:12>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d44028299-4eca6e88-cd53-4250-8b6c-2534c58c0bb8-000000%40eu-central-1.amazonses.com.

Reply via email to