Middleware Ordering

2008-09-06 Thread kevinski
I count 12 available middleware classes at http://docs.djangoproject.com/en/dev/ref/middleware/, however I can not find a complete listing of the best order to place them. I have read tips here and there about what to do with some of them, but can someone please provide me with the definitive

Middleware Ordering

2008-09-04 Thread kevinski
I count 12 available middleware classes at http://docs.djangoproject.com/en/dev/ref/middleware/, however I can not find a complete listing of the best order to place them. I have read tips here and there about what to do with some of them, but can someone please provide me with the definitive

Re: URL pre-processing middleware

2008-07-02 Thread Rajesh Dhawan
Hi, > > Is there somewhere I should be looking where I'm not? Some kind of > built in rewriter? Have you considered using Apache mod_rewrite instead of trying to solve this at the application layer? http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html Lighttpd and nginx also have simila

URL pre-processing middleware

2008-07-02 Thread David Christiansen
status code pointing at the new URL. It seems to me that the best way to do this would be to write a middleware class that works similarly to CommonMiddleware. However, I'm having a hard time creating one that I'm satisfied with. The problem is that anything I create will have to essen

Re: Django custom middleware question

2008-06-25 Thread csmith
Hey guys, thanks for the help. I actually got it working like this: class AliasMiddleware(object): def process_request(self, request): assert hasattr(request, 'session'), "The Django authentication middleware requires session middleware to be installed. Edit your MID

Re: Django custom middleware question

2008-06-25 Thread Alex Ezell
On Tue, Jun 24, 2008 at 11:14 PM, csmith <[EMAIL PROTECTED]> wrote: > > How can I add an attribute or variable? to the request object in > middleware, where I can use it in other views via the request object. > This is my custom middleware code so far: > > class AliasMidd

Re: Django custom middleware question

2008-06-25 Thread Alex Slesarev
> How can I add an attribute or variable? to the request object in > middleware, where I can use it in other views via the request object. You can use threading.local() variables, like this: import threading _thread_locals = threading.local() def get_current_user(): return g

Django custom middleware question

2008-06-24 Thread csmith
How can I add an attribute or variable? to the request object in middleware, where I can use it in other views via the request object. This is my custom middleware code so far: class AliasMiddleware(object): def process_request(self, request): assert hasattr(request, 'session&#x

Re: Middleware problem

2008-06-10 Thread Josh
quest, response): try: self.activity.set_request_time() except: pass return response and that took care of it. On May 28, 7:19 pm, Josh <[EMAIL PROTECTED]> wrote: > I created a custom middleware for logging requests based on this blog > post:http

Re: Need a Middleware to select urlpatterns

2008-06-06 Thread Siah
ld mean there must be a > > way for me to tell django to use a different urlpatterns. I checked on > > CommonMiddleware that does a bit of url-rewriting and found it does a > > HttpResponsePermenentRedirect and not change the actual url in place > > which seems odd to me as I

Re: Need a Middleware to select urlpatterns

2008-06-06 Thread Alex Koshelev
rl-rewriting and found it does a > HttpResponsePermenentRedirect and not change the actual url in place > which seems odd to me as I expected the middleware to rewrite the URL > in place. > > Thanks for all the help and your super framework, > Sia --~--~-~--~~~---~

Need a Middleware to select urlpatterns

2008-06-06 Thread Siah
that does a bit of url-rewriting and found it does a HttpResponsePermenentRedirect and not change the actual url in place which seems odd to me as I expected the middleware to rewrite the URL in place. Thanks for all the help and your super framework

Re: middleware irritation

2008-06-06 Thread Constantin Christmann
ity's process_response. Constantin Christmann schrieb: > Hello, > > lately I installed a middleware to track user activity on my website > (mainly code from this blog post > http://whijo.net/blog/brad/2007/07/19/statistics-logging-django.html) > > I use the following middlewar

middleware irritation

2008-06-05 Thread Constantin Christmann
Hello, lately I installed a middleware to track user activity on my website (mainly code from this blog post http://whijo.net/blog/brad/2007/07/19/statistics-logging-django.html) I use the following middleware classes: MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddl

Creating a request object + middleware benefits

2008-05-29 Thread Peter
I'm looking for a quick and simple way to create a request object - as it would be received by a specific view - for some very basic testing. Additionally, I want this object to have all the added attributes from the middleware modules e.g. request.user. I tried this: (1) I look

Middleware problem

2008-05-28 Thread Josh
I created a custom middleware for logging requests based on this blog post: http://whijo.net/blog/brad/2007/07/19/statistics-logging-django.html It's mostly working fine except for one thing. It causes problems when a URL without a trailing / is requested. In that case it gives me the foll

Middleware problem

2008-05-28 Thread Josh
I created a custom middleware for logging requests based on this blog post: http://whijo.net/blog/brad/2007/07/19/statistics-logging-django.html It's mostly working fine except for one thing. It causes problems when a URL without a trailing / is requested. In that case it gives me the foll

Re: Middleware not catching exceptions

2008-05-23 Thread Julien
I finally found that the problem was coming from another middleware of mine: class AuthRequiredMiddleware(object): def process_view(self, request, view_func, view_args, view_kwargs): if request.path.startswith(settings.MEDIA_URL) or request.path in settings.PUBLIC_PATHS

Re: Middleware not catching exceptions

2008-05-23 Thread Julien
Please ignore the "if DEBUG == True: blabla" statement, that was for testing. Just consider the list of middlewares above that. Don't understand why it doesn't work... On May 24, 8:41 am, Julien <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using the middle

Middleware not catching exceptions

2008-05-23 Thread Julien
Hi, I'm using the middleware from a snippet [1] so I could debug exceptions raised by ajax calls. That snippets simply displays the traceback in the console when an exception occurs: class ConsoleExceptionMiddleware: def process_exception(self, request, exception): import trac

Re: Is middleware appropriate for this?

2008-04-11 Thread Panos Laganakos
Thanks for the link Chris, but this is not what I'm trying to do. I'm not worried about the way the price look, but the price currency itself. Since the user is allowed to select that per session. If there's a way for a filter to access the session variables I would be OK, since instead of multip

Re: Is middleware appropriate for this?

2008-04-11 Thread Chris Moffitt
Take a look at what we use in Satchmo. Maybe this will help - http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop/templatetags/satchmo_currency.py -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Re: Is middleware appropriate for this?

2008-04-11 Thread Panos Laganakos
iables or the request session, I am wondering if middleware is the answer here. But I have no prior middleware experience :) Maybe a template tag would do it, not sure if it gets access to the request. On Apr 11, 2:55 pm, Dan Ellis <[EMAIL PROTECTED]> wrote: > On Apr 11, 11:37 am, Panos Laga

Re: Is middleware appropriate for this?

2008-04-11 Thread Dan Ellis
On Apr 11, 11:37 am, Panos Laganakos <[EMAIL PROTECTED]> wrote: > I'm wondering if working on a > middleware, `process_view` or something would be the right place to > make the conversion. Not a middleware, but a context processor. http://www.djangoproject.com/documentat

Is middleware appropriate for this?

2008-04-11 Thread Panos Laganakos
the filter itself instead of a string, so I'm curious how to make this happen. I don't want to do it in the model level (maybe defining a OneToMany with each currency to price), so I'm wondering if working on a middleware, `process_view` or something wo

Re: middleware that works with Ajax

2008-04-11 Thread Chris Hoeppner
r 9, 2008 at 1:47 AM, andy baxter > > > > > > > > Do you mean middleware specifically written for django? If so not sure, > > > > but it might be worth looking at dojo (http://www.dojotoolkit.org/). It > > > > is a javascript toolkit which provides an A

Re: middleware that works with Ajax

2008-04-10 Thread andy baxter
Jarek Zgoda wrote: > Chris Hoeppner napisał(a): > > >> This is new to me. Dojo will be the official js toolkit for django? >> Above jQuery? How come? >> > > No. It was stated many times: Django would not have any "official js > toolkit" and will not "be bound to" or "embrace" any single to

Re: middleware that works with Ajax

2008-04-09 Thread Russell Keith-Magee
On Thu, Apr 10, 2008 at 6:42 AM, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > On Wed, Apr 9, 2008 at 6:54 AM, Russell Keith-Magee <[EMAIL PROTECTED]> > wrote: > > On Wed, Apr 9, 2008 at 1:47 AM, andy baxter > > > > > > Do you mean middlewa

Re: middleware that works with Ajax

2008-04-09 Thread Todd O'Bryan
On Wed, Apr 9, 2008 at 6:54 AM, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On Wed, Apr 9, 2008 at 1:47 AM, andy baxter > <[EMAIL PROTECTED]> wrote: > > > > Do you mean middleware specifically written for django? If so not sure, > > but

Re: middleware that works with Ajax

2008-04-09 Thread Russell Keith-Magee
On Wed, Apr 9, 2008 at 1:47 AM, andy baxter <[EMAIL PROTECTED]> wrote: > > Do you mean middleware specifically written for django? If so not sure, > but it might be worth looking at dojo (http://www.dojotoolkit.org/). It > is a javascript toolkit which provides an API to m

Re: middleware that works with Ajax

2008-04-09 Thread Jarek Zgoda
Chris Hoeppner napisał(a): > This is new to me. Dojo will be the official js toolkit for django? > Above jQuery? How come? No. It was stated many times: Django would not have any "official js toolkit" and will not "be bound to" or "embrace" any single toolkit. You are free to use the toolkit of

Re: middleware that works with Ajax

2008-04-09 Thread Chris Hoeppner
Hey Mr. Baxter, This is new to me. Dojo will be the official js toolkit for django? Above jQuery? How come? ~ Chris El mar, 08-04-2008 a las 18:47 +0100, andy baxter escribió: > Claudio Escudero wrote: > > Hi, > > > > Someone knows there is any middleware that works

Re: middleware that works with Ajax

2008-04-08 Thread andy baxter
Claudio Escudero wrote: > Hi, > > Someone knows there is any middleware that works with Ajax, similar to > RJS of Ruby on Rails? > Do you mean middleware specifically written for django? If so not sure, but it might be worth looking at dojo (http://www.dojotoolkit.org/). It

Re: middleware that works with Ajax

2008-04-08 Thread Peter Rowell
Claudio, Your question made me look at RJS (which I had never heard of before) and at some stuff I did for a recently completed site. I think a rev 0.1 of something like RJS could be done in a weekend. I'll email you in the next day or so with some thoughts. Cheers, Peter --~--~-~--~

middleware that works with Ajax

2008-04-07 Thread Claudio Escudero
Hi, Someone knows there is any middleware that works with Ajax? Tranks, Claudio --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

middleware that works with Ajax

2008-04-07 Thread Claudio Escudero
Hi, Someone knows there is any middleware that works with Ajax, similar to RJS of Ruby on Rails? Tranks Claudio --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this g

Re: middleware question

2008-04-02 Thread Russell Keith-Magee
On 4/3/08, Chris <[EMAIL PROTECTED]> wrote: > > Can anyone help me with this? It looks like I need to pass in a > django_content_type= to the request context > before it gets passed to the middleware for further processing. Any > thoughts? Yes. I think you need to wait

Re: middleware question

2008-04-02 Thread Chris
Can anyone help me with this? It looks like I need to pass in a django_content_type= to the request context before it gets passed to the middleware for further processing. Any thoughts? On Apr 2, 3:37 pm, Chris <[EMAIL PROTECTED]> wrote: > Is there a way to grab content_type and objec

middleware question

2008-04-02 Thread Chris
Is there a way to grab content_type and object_id in a middleware processor? Example if I went to my articles section: http://www.xyz.com/articles// could I some how get the content_type and the object_id from the request context that is passed in? I want to be able to perform a middleware task

Re: How/where do you add middleware (was: empty PATH_INFO with LiteSpeed / FastCGI)

2008-02-20 Thread Joseph Heck
Austin, There's an excellent overview of the how's and why's of Middleware at http://www.djangoproject.com/documentation/middleware/ Fundamentally, you're just specifying a class that you've implemented somewhere. It can be in a folder or not - that's just matchin

How/where do you add middleware (was: empty PATH_INFO with LiteSpeed / FastCGI)

2008-02-17 Thread Austin Govella
On Jan 22, 9:39 pm, Dan Conner <[EMAIL PROTECTED]> wrote: > well, one way to do this is through a middleware class, like this: > class SetEmptyPathInfo(object): >     def process_request(self, request): >         if not request.path: >             re

Re: "Can't pickle function objects" in Sessions middleware. Any help ?

2008-01-18 Thread Jarek Zgoda
David Marquis napisał(a): > 'Can't pickle function objects' > > I can't seem to understand why on earth Django is trying to pickle a > 'function' into the user's session. > This error often happens when users leave their browser open and try > to continue the process later on (a few hours la

"Can't pickle function objects" in Sessions middleware. Any help ?

2008-01-18 Thread David Marquis
Hi folks, My first post on the forum! I've been watching the threads for a while, but now I need your help :) For a recent project, my users sometimes get the following error: (this error is output raw to the user, as text sent back to the browser as the response content) ** Mod_python

Re: Curious bugs with middleware (but possible with other features).

2008-01-13 Thread Grindizer
t; > On 13 янв, 13:53, Grindizer <[EMAIL PROTECTED]> wrote: when i wrote MyMiddleware i juste wanted to give a symbolic name (like P or APP1). The real name of my middleware is ProfileMiddleware (sorry, for MIDDLEWARE_CLASSES i juste make a copy/past of my project i repla

Re: Curious bugs with middleware (but possible with other features).

2008-01-13 Thread Alex Koshelev
n this project i define several applications, APP1, APP2, APP3 > > In INSTALLED_APPS of my settings i add those application with full > name, > ("P.APP1", "P.APP2", etc.) > > and all was working fine. (Admin interface and front end). > > After i wrote a middle

Curious bugs with middleware (but possible with other features).

2008-01-13 Thread Grindizer
Hello. I have one project let say P, In this project i define several applications, APP1, APP2, APP3 In INSTALLED_APPS of my settings i add those application with full name, ("P.APP1", "P.APP2", etc.) and all was working fine. (Admin interface and front end). After i wrot

Re: Middleware for checking client info and many other queries

2008-01-12 Thread Ravi Kumar
now I have to implement Django (which came out to be something I was > > needing as framework). Familiar with Django basics and some core > features, I > > am still looking for some knwoledge base for certain issues. > > > > 1. I need a middleware intercepting request, and findi

Re: Middleware for checking client info and many other queries

2008-01-09 Thread Udi
for certain issues. > > 1. I need a middleware intercepting request, and finding if client request > has cookies in it. If not, then I want to redirect that request to a page > which serves a page with some user states (such as random unique uid > assigned so his navigation and page accesse

Re: Middleware for checking client info and many other queries

2008-01-09 Thread Graham Dumpleton
On Jan 9, 6:04 pm, "Ravi Kumar" <[EMAIL PROTECTED]> wrote: > Yes, I am using older self compiled version. Hmm, > Well, lets look at what the new release has now. > Are you people sure when I setup Django on mod_python+Apache+Linux, there > won't be memory issues like what I read about the older mo

Re: Middleware for checking client info and many other queries

2008-01-08 Thread Ravi Kumar
Yes, I am using older self compiled version. Hmm, Well, lets look at what the new release has now. Are you people sure when I setup Django on mod_python+Apache+Linux, there won't be memory issues like what I read about the older mod_python. Any suggestions to take about during setup or such. >

Re: using re.sub with unicode string in response middleware

2008-01-08 Thread Malcolm Tredinnick
estion doesn't make sense in many situations. What's the character set encoding of a PNG image? :-) It might even be that some text encodings fail to meet that requirement, but they clearly aren't that common and it's only going to be a requirement for legacy systems (in

Re: using re.sub with unicode string in response middleware

2008-01-08 Thread Gary Wilson Jr.
Malcolm Tredinnick wrote: > Hey Gary, > > On Tue, 2008-01-08 at 00:35 -0600, Gary Wilson Jr. wrote: > [...] >> So, looking at a couple places in Django trunk where response.content is >> used, >> these look like bugs: >> >> >> django.contrib.csrf.middleware.CsrfMiddleware.process_response: >> >>

Re: using re.sub with unicode string in response middleware

2008-01-08 Thread Malcolm Tredinnick
tring as the first argument and a bytestring (request.content) as the second argument. The CSRF middleware is using bytestrings throughout, so it's safe. > django.test.testcases.TestCase.assertContains: > > def assertContains(self, response, text, count=None, status_code=200): >

Re: Middleware for checking client info and many other queries

2008-01-08 Thread Graham Dumpleton
On Jan 8, 11:36 pm, "Ravi Kumar" <[EMAIL PROTECTED]> wrote: > I am sorry. I mean to say "Django on Apache" has some memory overusage and > leak problem due to mod_python or whatever :) To repeat was Kenneth said but in respect of your clarification, 'where did you hear this? It is not true. '. :-

Re: Middleware for checking client info and many other queries

2008-01-08 Thread Ravi Kumar
I did that. --~--~-~--~~~---~--~~ 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

Re: Middleware for checking client info and many other queries

2008-01-08 Thread Alex Koshelev
ame out to be something I was > needing as framework). Familiar with Django basics and some core features, I > am still looking for some knwoledge base for certain issues. > > 1. I need a middleware intercepting request, and finding if client request > has cookies in it. If not, then I

Re: Middleware for checking client info and many other queries

2008-01-08 Thread Ravi Kumar
I am sorry. I mean to say "Django on Apache" has some memory overusage and leak problem due to mod_python or whatever :) But i did read those docs. Suggestion were to restart (using cron, stop then start rather than restart) to release those. So if this is true, is there any way to command it. Any

Re: using re.sub with unicode string in response middleware

2008-01-07 Thread Gary Wilson Jr.
t;> bytestring. >>>> I'm playing with a response middleware doing something like: >>>> >>>> MY_RE.sub(u'%s' % text, response.content) >>>> >>>> which raises a UnicodeDecodeError if response.content contains non-ascii. >>>

Re: Middleware for checking client info and many other queries

2008-01-07 Thread Kenneth Gonsalves
On 08-Jan-08, at 11:05 AM, Ravi Kumar wrote: > 3. I was reading some pros-cons about Django. I came to know Django > has a memory problem in deployment environment, leaked memory. I > also read many articles regarding how to prevent such leakage and > hogging where did you hear this? It i

Middleware for checking client info and many other queries

2008-01-07 Thread Ravi Kumar
need a middleware intercepting request, and finding if client request has cookies in it. If not, then I want to redirect that request to a page which serves a page with some user states (such as random unique uid assigned so his navigation and page accesses can be recorded). The page would use

Re: using re.sub with unicode string in response middleware

2008-01-07 Thread Malcolm Tredinnick
On Mon, 2008-01-07 at 18:28 -0600, Gary Wilson Jr. wrote: > Malcolm Tredinnick wrote: > > On Sun, 2008-01-06 at 15:25 -0600, Gary Wilson Jr. wrote: > >> It appears that at this point, response.content is a utf8-encoded > >> bytestring. > >> I'm playing w

Re: using re.sub with unicode string in response middleware

2008-01-07 Thread Gary Wilson Jr.
Malcolm Tredinnick wrote: > On Sun, 2008-01-06 at 15:25 -0600, Gary Wilson Jr. wrote: >> It appears that at this point, response.content is a utf8-encoded bytestring. >> I'm playing with a response middleware doing something like: >> >> MY_RE.sub(u'%s' %

Re: using re.sub with unicode string in response middleware

2008-01-06 Thread Malcolm Tredinnick
On Sun, 2008-01-06 at 15:25 -0600, Gary Wilson Jr. wrote: > It appears that at this point, response.content is a utf8-encoded bytestring. > I'm playing with a response middleware doing something like: > > MY_RE.sub(u'%s' % text, response.content) > > whi

using re.sub with unicode string in response middleware

2008-01-06 Thread Gary Wilson Jr.
It appears that at this point, response.content is a utf8-encoded bytestring. I'm playing with a response middleware doing something like: MY_RE.sub(u'%s' % text, response.content) which raises a UnicodeDecodeError if response.content contains non-ascii. I understand that the

Re: cache middleware and middlewareorder

2007-12-21 Thread Rock
On Dec 5, 7:02 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > If you're using CACHE_MIDDLEWARE_ANONYMOUS_ONLY you need a different > middleware ordering, as the error message says. That setting is a real > hack and I'd love to implement it in a better way some

Re: cache middleware and middlewareorder

2007-12-05 Thread Malcolm Tredinnick
On Wed, 2007-12-05 at 15:26 +0100, Paul Rauch wrote: > hi list, > > I got some Problems with the middlewareorder of cachemiddlerware, > since it does not seem possible to order it the right way. > > >Put the CacheMiddleware before any other middleware that might add >

cache middleware and middlewareorder

2007-12-05 Thread Paul Rauch
hi list, I got some Problems with the middlewareorder of cachemiddlerware, since it does not seem possible to order it the right way. >Put the CacheMiddleware before any other middleware that might add >something to the Vary header (response middleware is applied in reverse >or

Re: Custom middleware for logging

2007-10-20 Thread Steve Potter
fined pattern it > > would log that request as well as place a cookie on the client. > > > Is custom middleware the correct place to do this? > > Yes. It sounds like you want to use process_request, do your > matching, and either log right then, or, if you need to wait

Re: Custom middleware for logging

2007-10-19 Thread Jeremy Dunck
On 10/19/07, Steve Potter <[EMAIL PROTECTED]> wrote: > > I would like to put together a piece of code that will test the > referer for each request and if it matches a predefined pattern it > would log that request as well as place a cookie on the client. > > Is custo

Custom middleware for logging

2007-10-19 Thread Steve Potter
I would like to put together a piece of code that will test the referer for each request and if it matches a predefined pattern it would log that request as well as place a cookie on the client. Is custom middleware the correct place to do this? Also, I'm not exactly clea

Re: middleware introspection

2007-10-05 Thread Jeremy Dunck
On 10/5/07, Robin Becker <[EMAIL PROTECTED]> wrote: > can the middleware determine the template used by V0 so that it can be used > automatically to generate V2? Yes. Have a look at django.test.utils.instrumented_test_render and .setup_test_environment. You'll see a w

middleware introspection

2007-10-05 Thread Robin Becker
A colleague is writing a response middleware which hijacks the normal view under certain circumstances. Diagramatically V0 -->M(0)--> V1 is the normal case view V0 goes directly to V1 ie the middleware M does nothing. when the hijack is to take place V0 -->M(1)-->V2-->M(

Determine current appname in middleware

2007-09-28 Thread eXt
Hi! I wonder if there is any way to get current appname in middleware. I'm going to build one universal middleware that will be used for some different applications. My problem is that the middleware must read some data from a db table (and put it into request) and the table name is diff

Re: Talk like a Pirate Middleware

2007-09-19 Thread Scott Benjamin
jamin <[EMAIL PROTECTED]> wrote: > > > Today I was looking for some middleware that would allow changing of > > the text of a site into Pirate Talk without effecting the content, as > > today was Talk like a Pirate day.http://www.talklikeapirate.com/. > > There was

Re: Talk like a Pirate Middleware

2007-09-19 Thread Nowell
Jacob wrote something like this a while ago http://toys.jacobian.org/misc/pirate.py.txt On Sep 19, 5:26 am, Scott Benjamin <[EMAIL PROTECTED]> wrote: > Today I was looking for some middleware that would allow changing of > the text of a site into Pirate Talk without effecting the

Talk like a Pirate Middleware

2007-09-19 Thread Scott Benjamin
Today I was looking for some middleware that would allow changing of the text of a site into Pirate Talk without effecting the content, as today was Talk like a Pirate day. http://www.talklikeapirate.com/ . There wasn't anything available for Django that would change site text into "P

Re: Cache middleware causing unit tests to fail

2007-08-19 Thread Norman Harman
Eratothene wrote: > I think you better not disable cache middleware in tests. If tests > fail, so will be in production. I had similar problem, I thought it > was something wrong with tests, but really it was problem in the code. > My site was running well on django built-in server

Re: Cache middleware causing unit tests to fail

2007-08-18 Thread Sasha Weberov
ommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.middleware.doc.XViewMiddleware', > 'django.middleware.cache.CacheMiddleware', > 'django.contrib.flatpages.middleware.FlatpageFal

Re: Cache middleware causing unit tests to fail

2007-08-18 Thread Placid Publishing, LLC
ddleware', 'django.middleware.cache.CacheMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', ) Eratothene wrote: > I think you better not disable cache middleware in tests. If tests > fail, so will be in production. I had simila

Re: Cache middleware causing unit tests to fail

2007-08-18 Thread Eratothene
I think you better not disable cache middleware in tests. If tests fail, so will be in production. I had similar problem, I thought it was something wrong with tests, but really it was problem in the code. My site was running well on django built-in server, but not on apache mod_python. The

Re: Cache middleware causing unit tests to fail

2007-08-16 Thread Malcolm Tredinnick
On Thu, 2007-08-16 at 17:05 -0600, Norman Harman wrote: > Hi, > > request.template is None instead of what it should be because the response is > from the > cache middleware. > > Which is fine. My question is there a good way to disable the cache > middleware dur

Cache middleware causing unit tests to fail

2007-08-16 Thread Norman Harman
Hi, request.template is None instead of what it should be because the response is from the cache middleware. Which is fine. My question is there a good way to disable the cache middleware during tests? "good" being atleast the following. is automatic, isn't based of

Re: CacheMiddleware and middleware orders matters

2007-08-16 Thread Eratothene
/5176 On 16 авг, 02:46, "Kai Kuehne" <[EMAIL PROTECTED]> wrote: > Hi Erarothene, > > On 8/16/07, Eratothene <[EMAIL PROTECTED]> wrote: > > > > > I am totally confused with CacheMiddleware docs and middleware docs. > > > I want to use su

Re: CacheMiddleware and middleware orders matters

2007-08-15 Thread Kai Kuehne
Hi Erarothene, On 8/16/07, Eratothene <[EMAIL PROTECTED]> wrote: > > I am totally confused with CacheMiddleware docs and middleware docs. > > I want to use such middlewares in project: > ConditionalGetMiddleware > GZipMiddleware - addes Vary on Accept-Encoding > Sessio

CacheMiddleware and middleware orders matters

2007-08-15 Thread Eratothene
I am totally confused with CacheMiddleware docs and middleware docs. I want to use such middlewares in project: ConditionalGetMiddleware GZipMiddleware - addes Vary on Accept-Encoding SessionMiddleware - addes Vary on Cookie CacheMiddleware - I am trying to find correct order for this

Re: learning django's HttpRequest Object and Middleware

2007-07-31 Thread Joseph Heck
The middleware is loaded by whatever is serving your requests, and when it loads it'll process through that file - invoking "foofunc()" in the path and executing it. I'm not sure I understand your second question though. -joe On 7/31/07, james_027 <[EMAIL PROTECTED

Re: learning django's HttpRequest Object and Middleware

2007-07-31 Thread james_027
Hi Thomas > The methods of each middleware are called one for every request. If your > changes need information from the request, that's the right place. > > If you want to add a method which should be added once the server (mod_python, > scgi, ...) starts you can use this

Re: learning django's HttpRequest Object and Middleware

2007-07-31 Thread Thomas Guettler
Am Dienstag, 31. Juli 2007 11:26 schrieb james_027: > Hi, > > I want to make sure that my understanding is right. is middleware the > place where I can add more attribute to the HttpRequest Object and > manipulate the added attribte? > > Is this advisable? if Not where is the

learning django's HttpRequest Object and Middleware

2007-07-31 Thread james_027
Hi, I want to make sure that my understanding is right. is middleware the place where I can add more attribute to the HttpRequest Object and manipulate the added attribte? Is this advisable? if Not where is the right place to do it? Thanks james

middleware or context_processors

2007-07-26 Thread james_027
sy as the django user model I can make a middleware like this from ksk.main.models import Profile class ProfileMiddleware(object): """Use to synchronize django user and ksk profile""" def process_request(self, request): if request.user.is_authenticat

Re: using middleware vs. context_processors: best practice?

2007-07-14 Thread Jeremy Dunck
On 7/14/07, Amit Ramon <[EMAIL PROTECTED]> wrote: > 1. The language must be set before creating the menu (so the menu will be in > the correct language). I assume that middleware gets called before context > processors. Am I right here? Yes. > 2. I noticed that the middle

using middleware vs. context_processors: best practice?

2007-07-14 Thread Amit Ramon
se (it's simply another model), and I have a function that creates the menu and I pass it to the template in the extra_context. Following a tip from Malcolm (thanks!), in order not to repeat code for doing 1 in each and every view, I created a custom middleware that sets the language in its

html validator middleware

2007-06-18 Thread Brian St. Pierre
I recently hacked together a small middleware that validates all outgoing html and if it encounters a validation error, throws a 500 status code and error page with the validation error message(s) and html source. Similar in aim to Luke Plant's Validator App (http://lukeplant.me.uk/ reso

Re: View (maybe middleware?) question

2007-05-31 Thread Chris Kelly
ore for the look and feel when the users visit the site. I can probably get away with restricting it to this particular app (in the middleware) and just create a list of common view urls that it should ignore when looking at the theme portion of the url, so as to avoid strange path catches. -Chris On

Re: View (maybe middleware?) question

2007-05-30 Thread orestis
I've done something similar to this, putting the site language in the url. Basically you create a middleware process_request, that will take request.path and set it to something else. For example you might do: request.path = "/app/theme/view/" parts = request.path.split(&qu

Re: View (maybe middleware?) question

2007-05-30 Thread Robert Coup
Chris Kelly wrote: > I am in the process of writing an app that will have a "theme" based > on if a subdirectory is specified e.g.: > > http://somesite.com/app/(theme)/abunchofviews/ > > basically, if they go to /app/bluetheme/register, it'll give them a > registration page with a blue theme heade

View (maybe middleware?) question

2007-05-30 Thread Chris Kelly
about if this would be a candidate for being written as middleware? Right now it looks like I only need it for this particular app, and not any other ones on the site, if that makes a difference. I am a little new to writing middleware, so please tell me if you think there is a better way to do t

Conditional vs. Common middleware for returning 304 (not modified)

2007-05-25 Thread ezln23
limited testing, it seems to work. But, I am wondering why there are two middleware that support this and which one I should use (or both). Thanks in advance... CT --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Middleware tests location

2007-05-24 Thread Eugene Morozov
Hello, I have a custom middleware class that would be used project-wide. I've put it in the 'middleware' subdirectory of my project because it doesn't really belong to any app. The question is where to put tests for such code that exists outside of any application? Django

Re: browser detection middleware

2007-05-22 Thread Simon Willison
On May 22, 9:38 am, omat <[EMAIL PROTECTED]> wrote: > Is it a good idea to use a middleware class to detect the browser > client looking at the HTTP_USER_AGENT so as to serve presentation > logic accordingly, for mobile devices or older browsers, etc...? I would advise against

<    1   2   3   4   5   6   7   >