[Django] #28094: Cache settings override does not work properly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Django] #28094: Cache settings override does not work properly

Django
#28094: Cache settings override does not work properly
---------------------------------------------+------------------------
               Reporter:  R3turnz            |          Owner:  nobody
                   Type:  Bug                |         Status:  new
              Component:  Testing framework  |        Version:  1.11
               Severity:  Normal             |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 The following should override the CACHES setting during tests:
 {{{#!python
 @method_decorator(cache_page(60 * 5), name='dispatch')
 class IndexView(generic.ListView):

 if ENABLE_CACHING:
     CACHES = get_cache()
 else:
     CACHES = {
         'default': {
             'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
         }
     }

 @override_settings(CACHES={'default': {'BACKEND':
 'django.core.cache.backends.dummy.DummyCache'}})
 class IndexViewTests(TestCase):
 }}}
 The setting also seems to be correctly overriden, (django.conf.settings
 contains dummy cache) but I encounter following problems:
 * The context of the response is always None.
 * Test which formerly passed now fail and view functions are not called.
 All problems disappear when I disable caching **manually**!
 This leads me to the assumption that the views are stilled cached.
 The documentation says that overriding the cache should be possible and I
 am not using sessions framwork.
 I do not have enough knowledge of the architecture of django to do further
 debugging.

--
Ticket URL: <https://code.djangoproject.com/ticket/28094>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.364be1c32844c808258c5e1923e57141%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Django] #28094: Cache settings override does not work properly

Django
#28094: Cache settings override does not work properly
-----------------------------------+--------------------------------------
     Reporter:  R3turnz            |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  Testing framework  |                  Version:  1.11
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------

Comment (by Tim Graham):

 I suspect this is not a bug but that you'll have to reinitialize the
 class-based view after overriding the `CACHES` setting since it's already
 been initialized with the original settings values.

 If that's correct, perhaps
 [https://github.com/django/django/blob/43b4a1618ed85151494d68778a1bb6304ce1cb79/docs/topics/testing/tools.txt#L1265-L1270
 the documentation] could be clarified.

--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:1>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.de60ff5d3d5716f850d6a705e0c0793d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Django] #28094: Cache settings override does not work properly

Django
In reply to this post by Django
#28094: Cache settings override does not work properly
-----------------------------------+--------------------------------------
     Reporter:  R3turnz            |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  Testing framework  |                  Version:  1.11
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------

Comment (by R3turnz):

 I agree with you that this could be the problem, but how do reinitialize
 the settings?

--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:2>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.ae8d0992e3541d87b806d42dc4136668%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Django] #28094: Document how @override_settings(CACHES=...) can work with class-based views (was: Cache settings override does not work properly)

Django
In reply to this post by Django
#28094: Document how @override_settings(CACHES=...) can work with class-based views
-------------------------------------+-------------------------------------
     Reporter:  R3turnz              |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Documentation        |                  Version:  1.11
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * type:  Bug => Cleanup/optimization
 * component:  Testing framework => Documentation


Comment:

 I'm not sure if there's an elegant way for this to work.

--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:3>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.3481af1831cc537517264533ade8bfbe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Django] #28094: Document how @override_settings(CACHES=...) can work with class-based views

Django
In reply to this post by Django
#28094: Document how @override_settings(CACHES=...) can work with class-based views
--------------------------------------+------------------------------------
     Reporter:  R3turnz               |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Documentation         |                  Version:  1.11
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

 * stage:  Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:4>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.92675a4134b8428bc3f7ccdb03d2f580%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Loading...