Re: confused about the order of the CacheMiddleware in MIDDLEWARE_CLASSES

2007-07-27 Thread iww

I am a newbie of django.

In my opinion, it means the CacheMiddleware module process shoule
after the
SessionMiddleware .

According to WSGI specification,  CacheMiddleware shoule be the
"client" of the
SessionMiddleware. So we should put CacheMiddleware before
SessionMiddleware .



On 7月14日, 下午4时00分, Mesh007 <[EMAIL PROTECTED]> wrote:
> Can any body give me some help information?
>
> Thanks very much
>
> On 7月13日, 下午3时06分, Mesh007 <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi, all:
>
> > I touch django not long before, and am learning it, when i touch the
> > CacheMiddleware, i am confused confused about the order of  the
> > CacheMiddleware in MIDDLEWARE_CLASSES
>
> > It is say: "Put the CacheMiddleware after any middlewares that might
> > add something to the Vary header. " in the 
> > documentation(http://www.djangoproject.com/documentation/0.96/cache/)
>
> > because SessionMiddleware and GZipMiddleware add Vary header, so, i
> > code below in my settings.py:
> > MIDDLEWARE_CLASSES = (
> > 'django.middleware.common.CommonMiddleware',
> > 'django.contrib.sessions.middleware.SessionMiddleware',
> > 'django.contrib.auth.middleware.AuthenticationMiddleware',
> > 'django.middleware.cache.CacheMiddleware',
> > )
> > but it doesn't work well, I use
> > "request.COOKIES.get('sessionid','null') " show the sessionid on page,
> > but it show the same value on different browser(the real session id is
> > not that showd on page), it seem it should save differrnt version
> > cache based vary header, In browser the vary header is Cookie
>
> > I see the codes below in file django/core/handlers/base.py (svn
> > version)
> > 47th line: self._response_middleware.insert(0,
> > mw_instance.process_response)
>
> > Is it means  from bottom from top middleware in MIDDLEWARE_CLASSES
> > when process the response?
> > so i guess that the CacheMiddleware should put before the
> > SessionMiddleware, because the SessionMiddleware add cookie vary
> > header, so the CacheMiddleware can get the vary header added by the
> > SessionMiddleware in response object, but , i not sure,.- 隐藏被引用文字 -
>
> - 显示引用的文字 -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: confused about the order of the CacheMiddleware in MIDDLEWARE_CLASSES

2007-07-14 Thread Mesh007

Can any body give me some help information?

Thanks very much


On 7月13日, 下午3时06分, Mesh007 <[EMAIL PROTECTED]> wrote:
> Hi, all:
>
> I touch django not long before, and am learning it, when i touch the
> CacheMiddleware, i am confused confused about the order of  the
> CacheMiddleware in MIDDLEWARE_CLASSES
>
> It is say: "Put the CacheMiddleware after any middlewares that might
> add something to the Vary header. " in the 
> documentation(http://www.djangoproject.com/documentation/0.96/cache/)
>
> because SessionMiddleware and GZipMiddleware add Vary header, so, i
> code below in my settings.py:
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.middleware.cache.CacheMiddleware',
> )
> but it doesn't work well, I use
> "request.COOKIES.get('sessionid','null') " show the sessionid on page,
> but it show the same value on different browser(the real session id is
> not that showd on page), it seem it should save differrnt version
> cache based vary header, In browser the vary header is Cookie
>
> I see the codes below in file django/core/handlers/base.py (svn
> version)
> 47th line: self._response_middleware.insert(0,
> mw_instance.process_response)
>
> Is it means  from bottom from top middleware in MIDDLEWARE_CLASSES
> when process the response?
> so i guess that the CacheMiddleware should put before the
> SessionMiddleware, because the SessionMiddleware add cookie vary
> header, so the CacheMiddleware can get the vary header added by the
> SessionMiddleware in response object, but , i not sure,.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---