Middleware to replace @login_required

2009-10-15 Thread Shawn Milochik
Middleware question: If 100% of an apps views require a logged-in user except for the login page, does it makes sense to have middleware check the URL and redirect to the login page rather than putting the @login_required decorator over all the views? I have to ensure that users' pass

Re: Middleware stored locally

2009-10-14 Thread BenW
llowing: > > [Thu Oct 15 00:56:39 2009] [error] [client 127.0.0.1]     raise > exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' > % (mw_module, e) > [Thu Oct 15 00:56:39 2009] [error] [client 127.0.0.1] > ImproperlyConfigured: Error im

Middleware stored locally

2009-10-14 Thread When ideas fail
s in is \Apache2.2\myapp\lib\django_authopenid but I get a 500 Internal Server and the error log tells me the following: [Thu Oct 15 00:56:39 2009] [error] [client 127.0.0.1] raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module,

Re: Will it lost some features(middleware/contextprocessor) of Django when using Jinja2 ?

2009-10-05 Thread John Wang
Thanks Kristaps , I finally found the http://github.com/dcramer/coffin coffin package is just what i need. It works well as far as context processor and middleware are concerned. Kristaps Kūlis wrote: > > Hi! > You can use RequestContext (and also middlewares and context

Re: Will it lost some features(middleware/contextprocessor) of Django when using Jinja2 ?

2009-10-04 Thread Kristaps Kūlis
, John Wang wrote: > > Hi all, > > I want to use Jinja2 in a django project but keep some features > django, e.g, middleware and context processor. > > My question is, can I still use middleware and contextprocess in > django when replace it template with Jinja2 ? > > B

Will it lost some features(middleware/contextprocessor) of Django when using Jinja2 ?

2009-10-03 Thread John Wang
Hi all, I want to use Jinja2 in a django project but keep some features django, e.g, middleware and context processor. My question is, can I still use middleware and contextprocess in django when replace it template with Jinja2 ? BTW, what most i like jinja2 is that i can define macros in it

Re: Can i rise 404 from my middleware ?

2009-08-07 Thread Mirat Bayrak
2009/8/5 Malcolm Tredinnick > > On Wed, 2009-08-05 at 09:29 +0300, Mirat Can Bayrak wrote: > > On Tue, 4 Aug 2009 16:47:37 -0500 > > Alex Gaynor wrote: > [...] > > > > Right now there is a bug in django's middleware where it doesn't > > > cor

Re: Can i rise 404 from my middleware ?

2009-08-04 Thread Malcolm Tredinnick
On Wed, 2009-08-05 at 09:29 +0300, Mirat Can Bayrak wrote: > On Tue, 4 Aug 2009 16:47:37 -0500 > Alex Gaynor wrote: [...] > > Right now there is a bug in django's middleware where it doesn't > > correct catch exceptions: http://code.djangoproject.com/ticket/6094.

Re: Can i rise 404 from my middleware ?

2009-08-04 Thread Mirat Can Bayrak
On Tue, 4 Aug 2009 16:47:37 -0500 Alex Gaynor wrote: > > On Tue, Aug 4, 2009 at 4:45 PM, Mirat Can > Bayrak wrote: > > > > Question is simple. i tried to use raise Http404 from middleware and that > > is not working. > > > > My middlewar

Re: Can i rise 404 from my middleware ?

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 4:45 PM, Mirat Can Bayrak wrote: > > Question is simple. i tried to use raise Http404 from middleware and that is > not working. > > My middleware is : > > import urlparse > from django.contrib.sites.models import Site > from django.ht

Can i rise 404 from my middleware ?

2009-08-04 Thread Mirat Can Bayrak
Question is simple. i tried to use raise Http404 from middleware and that is not working. My middleware is : import urlparse from django.contrib.sites.models import Site from django.http import Http404 class GetSubdomainMiddleware: def process_request(self, request

Re: Middleware that injects data for template

2009-07-25 Thread Daniel Roseman
On Jul 24, 8:24 pm, Stodge wrote: > Say I want to inject a piece of data into every page view. For now, > let's just say I want to inject the current time into each page view. > I write a piece of middleware that will do it. But how? Do I modify > the request? Or the view (pr

Re: Middleware that injects data for template

2009-07-24 Thread Tim Chase
Stodge wrote: > Say I want to inject a piece of data into every page view. For > now, let's just say I want to inject the current time into > each page view. I write a piece of middleware that will do it. > But how? Do I modify the request? Or the view (process_view)? I und

Middleware that injects data for template

2009-07-24 Thread Stodge
Say I want to inject a piece of data into every page view. For now, let's just say I want to inject the current time into each page view. I write a piece of middleware that will do it. But how? Do I modify the request? Or the view (process

Re: middleware cache problem

2009-07-22 Thread Alex Robbins
ct.com/en/dev/topics/cache/#the-low-level- cache-api [2]http://docs.djangoproject.com/en/dev/topics/cache/#template- fragment-caching On Jul 21, 9:59 am, Norman wrote: > per-view cache is not a solution because I need only a method to > retrieve fresh (not cached) data from middleware. >

Re: middleware cache problem

2009-07-21 Thread Norman
per-view cache is not a solution because I need only a method to retrieve fresh (not cached) data from middleware. I wanna take cached list of stories and not cached vote results for it. regards, Norman On Jul 21, 3:13 pm, Michael wrote: > On Tue, Jul 21, 2009 at 9:02 AM, Norman wr

Re: middleware cache problem

2009-07-21 Thread Michael
On Tue, Jul 21, 2009 at 9:02 AM, Norman wrote: > > Hi all, > > I cache my view that show a list of stories, but I have also small > voting button (like digg). Voting is done be middleware class (it > reads user IP), so I can ask for view with list of stories and tell > th

middleware cache problem

2009-07-21 Thread Norman
Hi all, I cache my view that show a list of stories, but I have also small voting button (like digg). Voting is done be middleware class (it reads user IP), so I can ask for view with list of stories and tell that this list shall be cached and I have to ask middleware for vote results

Re: Middleware help -- screwing up the admin

2009-07-08 Thread Ryan K
Please ignore this. I'm an idiot and placed the reference to the middleware in the template_context_processros settings. And so strange errors resulted. Please delete if possible. --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Middleware help -- screwing up the admin

2009-07-08 Thread Ryan K
I'm getting a very strange error: TypeError at /admin/ object.__new__() takes no parameters I've isolated the problematic code to my middleware for an application I built called staticpages. It uses the same mechanism and so the same middleware as flatpages. This is the code: from d

Re: per-application middleware

2009-07-07 Thread Javier Guerra
On Tue, Jul 7, 2009 at 11:32 AM, Philip Zeyliger wrote: > Hi, > > I have a project made up of several applications, and one of those > applications needs some specific middleware, whereas the others don't.  Is > there a way to enable middleware per-application? you can u

per-application middleware

2009-07-07 Thread Philip Zeyliger
Hi, I have a project made up of several applications, and one of those applications needs some specific middleware, whereas the others don't. Is there a way to enable middleware per-application? Thanks, -- Philip --~--~-~--~~~---~--~~ You received this me

Re: URL rewriting Middleware

2009-06-14 Thread JF Simon
OK, I found, I have to write the path in request.path_info !!! It works ! --~--~-~--~~~---~--~~ 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 uns

Middleware Authentication and 'get_and_delete_messages'

2009-05-31 Thread sahid
Hello, i use a native django in appengine i have create a authentication middleware in django,. I am inspired by contrib {{{ class LazyUser (object): def __get__ (self, request, obj_type = None): if not hasattr (request, '_cached_user'): from common import user

Re: Raises Http404 from Middleware?

2009-05-24 Thread ringemup
Finally did it. This is about as inelegant as it gets, but it seems to work. Instead of just raising Http404, you need to both raise it and catch the exception, then pass the exception off to what would normally handle it. try: raise Http4

Re: Raises Http404 from Middleware?

2009-05-24 Thread ringemup
Hate to bump threads, but this is a major problem -- has anyone found a workaround for this? --~--~-~--~~~---~--~~ 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@goog

Disabling middleware on a per view basis

2009-05-20 Thread luddep
Hello, I've been vigorously searching for a way to disable middleware on a per view basis, something like: @disable_middleware def my_view(request): ... I'm wondering if something like this might be possible right now or if anyone else has had the need for this? -- I

Re: Raises Http404 from Middleware?

2009-05-19 Thread ringemup
Yikes. Is there any workaround? Say, calling process_exception() on whatever middleware class usually handles this stuff? On May 19, 8:56 pm, Alex Gaynor wrote: > On Tue, May 19, 2009 at 7:54 PM, ringemup wrote: > > > When I raise a 404 exception from a middleware process_re

Re: Raises Http404 from Middleware?

2009-05-19 Thread Alex Gaynor
On Tue, May 19, 2009 at 7:54 PM, ringemup wrote: > > When I raise a 404 exception from a middleware process_request method, > the traceback is posted to the browser instead of a proper debug error > page. Is there something special one has to do in order to properly > return

Raises Http404 from Middleware?

2009-05-19 Thread ringemup
When I raise a 404 exception from a middleware process_request method, the traceback is posted to the browser instead of a proper debug error page. Is there something special one has to do in order to properly return a 404 page from middleware? Thanks

Re: Debug middleware

2009-05-02 Thread George Song
On 5/2/2009 9:53 AM, Malcolm Tredinnick wrote: > On Sat, 2009-05-02 at 04:11 -0700, Kless wrote: >> How to debug a middleware? I would print any variables for a >> middleware that I'm building >> >> Is there any way to make it? > > In any sensible web ser

Re: Debug middleware

2009-05-02 Thread Malcolm Tredinnick
On Sat, 2009-05-02 at 04:11 -0700, Kless wrote: > How to debug a middleware? I would print any variables for a > middleware that I'm building > > Is there any way to make it? In any sensible web server setup, printing to sys.stderr will send the output the server's er

Debug middleware

2009-05-02 Thread Kless
How to debug a middleware? I would print any variables for a middleware that I'm building Is there any way to make it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To pos

getting local variables in custom exception middleware

2009-04-27 Thread skunkwerk
Hi, i've been using django-db-log for logging exceptions when Debug=False, and I'd like to add the ability to log the local variables as well. Here is what I tried: def process_exception(self, request, exception): local_vars = repr(exception.tb_frame.f_locals.items()) however, tb_frame

Re: Per app middleware?

2009-03-23 Thread Malcolm Tredinnick
On Mon, 2009-03-23 at 14:20 +0100, Gabriel Rossetti wrote: > Hello everyone, > > I have a project that has two apps that use the same models (I moved it > out of the apps, up to the project's root). I was wondering if it is > possible to have global middleware (that they bo

Per app middleware?

2009-03-23 Thread Gabriel Rossetti
Hello everyone, I have a project that has two apps that use the same models (I moved it out of the apps, up to the project's root). I was wondering if it is possible to have global middleware (that they both need) and per app middleware (sspecific to each app). I don't want

Middleware or other way?

2009-03-06 Thread KrcK ---
Hi group, It´s possible that I can´t to explain yours very well my problem because it´s a complex problem (I think it) and my english is too poor but I´m going to try to do it. I´ve a problem and I´m not sure if create a middleware class is a good solution. I´ve one class that represents a set

middleware or signals for sqlalchemy Session

2009-02-24 Thread davidlmontgom...@gmail.com
I would like to know if there is a consensus on the best way to set up and remove sqlalchemy Session's in django. I figure I'm either going to use middleware, something like this thread: http://groups.google.com/group/django-users/browse_thread/thread/e6749f7eec1cc46c/ef9d9e27943af8

Re: Disabling middleware for tests

2009-02-16 Thread stryderjzw
Ah yeah, of course I can put a print statement. Thanks Malcolm. Your many posts have helped me greatly in the past. Looks like it works with a new Django project. I am using Pinax and they alter the manage.py file slightly. Can't see why it's not working though. I guess I'll have to dig in deepe

Re: Disabling middleware for tests

2009-02-16 Thread Malcolm Tredinnick
On Mon, 2009-02-16 at 18:36 -0800, stryderjzw wrote: [...] > However, I'm running into the problem that I have no clue if manage.py > ever read my settings file correctly. The settings file is executable (well, importable) Python code, so put a print statement in there that will display something

Re: Disabling middleware for tests

2009-02-16 Thread stryderjzw
Well, looking at Ticket 9172 (http://code.djangoproject.com/ticket/ 9172), we're supposed to be turning off the CSRF middleware during tests. I believe we can do that by writing another settings file, disabling the Csrf Middleware and using that settings file to run our tests, as per this t

Re: Disabling middleware for tests

2009-02-16 Thread felix
ah ha. yes, I've wasted several hours over this issue. it took me a while to figure out that it was the CSRF middleware that was breaking the tests. both auth tests and actually every single one that tests the posting of forms. I didn't see it mention of this issue in either the CS

Re: Disabling middleware for tests

2009-02-16 Thread stryderjzw
manage.py test --settings=mysite.settings-test.py > > Best, > Dave > > On Jan 22, 4:50 pm, Malcolm Tredinnick > wrote: > > > On Thu, 2009-01-22 at 15:17 -0800,davenaffwrote: > > > What is the best way to disable a specific middleware when running > > > d

AuthKit (WSGI middleware) and Django

2009-02-15 Thread Dennis
Wondering if it's common to modify WSGI middleware packages to be used in django. Also, wondering if it's difficult to do. I'm building a website with user authentication similar to facebook (so the user can stay logged in forever). Django's contrib auth module did not seem t

middleware response processing always occurs

2009-01-29 Thread George Lund
We recently uncovered a bug in our code, which was pretty confusing, and is explainable only via the fine-print of http://docs.djangoproject.com/en/dev/topics/http/middleware/ -- and reading through the Django source. So I thought I'd share, and maybe a Django developer might comment on wh

Re: Disabling middleware for tests

2009-01-26 Thread davenaff
Malcolm, Thanks a lot for the pointer. For anyone else interested, here is what my settings-test.py looks like: from settings import * # CSRF Middleware breaks auth tests MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES) MIDDLEWARE_CLASSES.remove ('django.contrib.csrf.middleware.CsrfMiddl

Middleware and domain name problems

2009-01-23 Thread b...@allwedo.com
in name to the new server. I have switched the DNS, but I get errors. CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True requires authentication middleware. If I comment out the caching stuff, I get ImproperlyConfigured: Error importing authentication backend wwwroot.middleware.email_auth: "

Re: Disabling middleware for tests

2009-01-22 Thread Malcolm Tredinnick
On Thu, 2009-01-22 at 15:17 -0800, davenaff wrote: > What is the best way to disable a specific middleware when running > django tests? > > This ticket was designated wontfix, so I get test failures on the auth > tests every time I run our test suite: > http://code.djangoproje

Disabling middleware for tests

2009-01-22 Thread davenaff
What is the best way to disable a specific middleware when running django tests? This ticket was designated wontfix, so I get test failures on the auth tests every time I run our test suite: http://code.djangoproject.com/ticket/9172#comment:12 I'd prefer not to have to edit settings.py

Question about transaction middleware

2009-01-15 Thread Sebastian Bauer
Hi, i have one simple question, why this middleware leave transaction in managed mode? i think this create a little hole to execute queries we dont want to execute. Thanks for answer --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Caching middleware struggle

2009-01-04 Thread pielgrzym
Hi there, I'm struggling to make caching middleware work with i18n middleware, with no success though (a user can't change the language - since he gets the first cached language site...). Those nifty decorators for vary headers don't help too. Same goes for the middleware itself

Re: Middleware, exceptions and POST

2009-01-04 Thread Roman Odaisky
HTML: If everything’s OK, the app never looks at the request URI. Only if there’s a validation failure, the middleware lets Django find the view that corresponds to the URI--which is the same view

Re: Middleware, exceptions and POST

2009-01-04 Thread Malcolm Tredinnick
On Sun, 2009-01-04 at 12:03 +0200, Roman Odaisky wrote: > Hi everyone, > > I have a (technical) problem with middleware, and also I’d be grateful to > hear > some suggestions about the general workflow. Doubtless all of you are > familiar with a topic as simple as POST h

Middleware, exceptions and POST

2009-01-04 Thread Roman Odaisky
Hi everyone, I have a (technical) problem with middleware, and also I’d be grateful to hear some suggestions about the general workflow. Doubtless all of you are familiar with a topic as simple as POST handling, and maybe some of you have improvements over the usual Django approach. So, I

Re: How to create middleware that adds context variables?

2008-12-27 Thread Roy
Ah, as a noob I was not aware of context processors! Thanks! On Dec 28, 5:13 am, bruno desthuilliers wrote: > On 27 déc, 17:42, Roy wrote: > > >  How to create middleware that adds context variables? > > Hi, anyone have any examples of the above? > > What's

Re: How to create middleware that adds context variables?

2008-12-27 Thread bruno desthuilliers
On 27 déc, 17:42, Roy wrote: > How to create middleware that adds context variables? > Hi, anyone have any examples of the above? What's wrong with context processors ? http://docs.djangoproject.com/en/dev/ref/templates/api/?#writing-your-own-context

How to create middleware that adds context variables?

2008-12-27 Thread Roy
Hi, anyone have any examples of the above? --~--~-~--~~~---~--~~ 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

Re: middleware import errors [solved]

2008-12-16 Thread Vladimir Kirillov
I've tested flup several times, but it wasn't it. Looks like the problem was really caused by right, but not valid path (which containes relative paths and django path was there three times accidentally), that caused recursive imports, afaik. the problem is solved, thanks On Dec 14, 2:48 am, Mal

Custom middleware to integrate with Facebook Connect

2008-12-14 Thread Bret W
I just wrote a small bit of middleware to allow Facebook users to log into my Django site with Facebook Connect. If you're looking to do something similar, check out my post: http://nyquistrate.com/django/facebook-connect/ --~--~-~--~~~---~--~~ You received

Re: middleware import errors

2008-12-13 Thread Malcolm Tredinnick
fcgi_base.py", line 1116, in handler >File "../lib/django/core/handlers/wsgi.py", line 228, in __call__ >File "../lib/django/core/handlers/base.py", line 40, in > load_middleware > ImproperlyConfigured: Error importing middleware > django.middleware.c

middleware import errors

2008-12-13 Thread Vladimir Kirillov
in run File "../lib/flup/server/fcgi_base.py", line 1116, in handler File "../lib/django/core/handlers/wsgi.py", line 228, in __call__ File "../lib/django/core/handlers/base.py", line 40, in load_middleware ImproperlyConfigured: Error importing middleware djan

Re: Custom Middleware TypeError exception

2008-12-05 Thread Rajesh Dhawan
On Dec 5, 11:20 am, Chris Smith <[EMAIL PROTECTED]> wrote: > Found an oddity - possibly in my code. Can't seem to work around it. > > Code in question (current multi-tenant middleware implementation): > > middleware.py .. > > from projectname

Re: Custom Middleware TypeError exception

2008-12-05 Thread Chris Smith
On Dec 5, 4:20 pm, Chris Smith <[EMAIL PROTECTED]> wrote: > Any ideas?  Is it something silly I've done? Actually, please ignore this. The exception was firing in user code due to me forgetting to handle a capture group in a URL regex. Back to the coffee machine... Cheers, Chris. --~--~-

Custom Middleware TypeError exception

2008-12-05 Thread Chris Smith
Found an oddity - possibly in my code. Can't seem to work around it. Code in question (current multi-tenant middleware implementation): middleware.py .. from projectname.models import Tenant, HostEntry from django.http import HttpResponseNotFound

Re: Custom middleware only works when debugging is on

2008-11-24 Thread shi shaozhong
Hello, there. I am very much interested in this middleware stuff. I have now a Python data processing script, which normally runs 2 to 3 minutes. I was trying to use feedback.py to call this external script as a subprocess, firing it off to run, monitoring its progress, and return an innerHTML

Re: Custom middleware only works when debugging is on

2008-11-20 Thread jwpeddle
Oh my god the stupidity. The error was in my 500.html template. NOTHING to do with my middleware. Sigh. On Nov 20, 1:54 pm, jwpeddle <[EMAIL PROTECTED]> wrote: > I've got a custom middleware class (nearly identical in function to > the flat page fallback middleware). When I

Re: Custom middleware only works when debugging is on

2008-11-20 Thread jwpeddle
Eliminated any possible issues in my urls conf. Even removing everything from it doesn't change the situation. On Nov 20, 1:54 pm, jwpeddle <[EMAIL PROTECTED]> wrote: > I've got a custom middleware class (nearly identical in function to > the flat page fallback middlewa

Re: Custom middleware only works when debugging is on

2008-11-20 Thread jwpeddle
Ok, I've tried to dumb things down, and it turns out the built-in flatpage fallback middleware ALSO doesn't have it's process_response called. I can only assume a response is sent before the middleware is reached, but I've got a pretty standard setup:

Custom middleware only works when debugging is on

2008-11-20 Thread jwpeddle
I've got a custom middleware class (nearly identical in function to the flat page fallback middleware). When I have DEBUG = True, it works as expected. When I have DEBUG = False, I get errors stemming from variables set by the middleware not existing for the templates. After investigating

Re: Order of Middleware

2008-11-18 Thread Malcolm Tredinnick
ions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > ) > > In the global_settings.py file there is: > > # List of middleware classes to use. Order is important; in the > request phase, > # this middleware classes will be applied in

Re: Order of Middleware

2008-11-17 Thread Steve Holden
ntrib.auth.middleware.AuthenticationMiddleware', > ) > > In the global_settings.py file there is: > > # List of middleware classes to use. Order is important; in the > request phase, > # this middleware classes will be applied in the order given, and in

Order of Middleware

2008-11-17 Thread Peter
ionMiddleware', ) In the global_settings.py file there is: # List of middleware classes to use. Order is important; in the request phase, # this middleware classes will be applied in the order given, and in the # response phase the middleware will be applied in reve

How do test Middleware

2008-11-14 Thread shabda
I want to write some test for my middleware seperate from the views that would be using them. So I am using this snippet http://www.djangosnippets.org/snippets/963/ to get a request, and calling my middleware with it to test it, but it looks a little hackish to me. Is there a better way

Re: creating django middleware

2008-11-14 Thread Malcolm Tredinnick
process_request 2008-11-14 14:36:14.531000 > process_response 2008-11-14 14:36:14.531000 > [14/Nov/2008 14:36:14] "GET /account/chart/ HTTP/1.1" 200 6717 > > Look at the 4th line: > "process_response process_response: db_session not found" > > Why for s

Re: creating django middleware

2008-11-14 Thread ershadul
Dear Steve Holden, Please consider the following block i wrote: def process_request(self, request): request.db_session = session() request.db_session.time_stamp = str(datetime.datetime.now()) print 'process_request', request.db_session.time_stamp def process_response(

Re: creating django middleware

2008-11-13 Thread Steve Holden
ershadul wrote: > Dear , > I dont know whether my process_request() is being called or not? > Can you inform me please, how can i verify that my middleware's > process_request() is called ? > > On Nov 12, 4:42 am, Steve Holden <[EMAIL PROTECTED]> wrote: >> ershadul wrote: >>> Dear all, >>> please

Re: creating django middleware

2008-11-12 Thread ershadul
Dear , I dont know whether my process_request() is being called or not? Can you inform me please, how can i verify that my middleware's process_request() is called ? On Nov 12, 4:42 am, Steve Holden <[EMAIL PROTECTED]> wrote: > ershadul wrote: > > Dear all, > > please consider the following code-

Re: creating django middleware

2008-11-12 Thread Jeff FW
I also wrote middleware for SQLAlchemy--I'd post it, but it depends on other libraries that I wrote that I can't really share. What I found is that, at least while using the dev server, the process_response method would get called when serving media files, even if the process_request h

Re: creating django middleware

2008-11-12 Thread Steve Holden
ershadul wrote: > Dear all, > please consider the following code-block: > > class SQLAlchemySessionMiddleware(object): > """ > This class instantiates a sqlalchemy session and destroys > """ > def process_request(self, request): > request.db_session = session() > re

creating django middleware

2008-11-12 Thread ershadul
I have added the path of this middleware class before XView middleware in settings.py. But i got a error that request has not attribute 'db_session' ( process_response function) How can i do it? --~--~-~--~~~---~--~~ You received this message because you are subscr

Re: middleware or view ?

2008-10-22 Thread Dmitry Dzhus
right place or best practice to do such > calculations, custom middleware or view ? How are you going to fit long-lasting calculations in «request/response» model at all? I'd perform calculations separately, using Django to provide user views to launch calculation, see its progress and ob

Re: middleware or view ?

2008-10-20 Thread Russell Keith-Magee
On Sun, Oct 19, 2008 at 7:27 PM, PonasNiekas <[EMAIL PROTECTED]> wrote: > > Thanks Russ for the replay. Your idea would certainly work and I agree > that > doing calculations outside django/web server makes sense. I will > probably > and up doing the way you described. > > On the other hand, havin

Admin uses sessions/auth middleware but don't need those in the main part of the site

2008-10-19 Thread danlester
I've added the admin app, along with necessary middleware. The sessions and authentication middleware required for admin are not needed for the main part of my site, so the vast majority of traffic will be given session identifiers etc that are never used. I haven't benchmarked in deta

Re: middleware or view ?

2008-10-19 Thread PonasNiekas
Thanks Russ for the replay. Your idea would certainly work and I agree that doing calculations outside django/web server makes sense. I will probably and up doing the way you described. On the other hand, having the whole thing in django without any external components would kinda be nice.. Would

Re: middleware or view ?

2008-10-19 Thread Russell Keith-Magee
t;calculation in progress" or smth). > > I'm wondering what is the right place or best practice to do such > calculations, custom middleware or view ? Neither. A view isn't really the right place to be performing long-lived calculations. While the calculation is being performed,

middleware or view ?

2008-10-18 Thread PonasNiekas
calculations, custom middleware or view ? Thanks, PonasNiekas --~--~-~--~~~---~--~~ 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 uns

Re: Issue with starting a process in middleware

2008-10-14 Thread bob
I didn't mean to imply no one was going to look at it. I'm sure it will get fixed. It's strange that on the surface nothing appears to be getting blocked but deep down something is getting deadlocked somewhere. If there is anything I can try to get more info let me know. Regards Bob > > > On Tue,

Re: Issue with starting a process in middleware

2008-10-14 Thread Malcolm Tredinnick
On Tue, 2008-10-14 at 08:21 +0100, [EMAIL PROTECTED] wrote: > I did Google around but obviously missed this. Having read it and followed > the links it is definitely the same issue. I will try and investigate but > I think bigger brains than mine have already given up so I may have to > find a di

Re: Issue with starting a process in middleware

2008-10-14 Thread bob
> > > On Mon, 2008-10-13 at 21:53 +0100, Bob Cowdery wrote: >> Hi all >> >> Just starting out on Django. I have an app that needs a long running >> process. This is a python process that gets started from some code that >> I kick off from __init__ in a mi

Re: Issue with starting a process in middleware

2008-10-13 Thread Malcolm Tredinnick
On Mon, 2008-10-13 at 21:53 +0100, Bob Cowdery wrote: > Hi all > > Just starting out on Django. I have an app that needs a long running > process. This is a python process that gets started from some code that > I kick off from __init__ in a middleware class. Is there another w

Issue with starting a process in middleware

2008-10-13 Thread Bob Cowdery
Hi all Just starting out on Django. I have an app that needs a long running process. This is a python process that gets started from some code that I kick off from __init__ in a middleware class. Is there another way to do this? I just use subprocess.Popen() to start the other process

Re: Custom middleware: using process_view to modify the view_func

2008-10-10 Thread barbara shaurette
override the view_func() that was passed in, > simply return new_view_func(). Similarly, if you want to override the > view_args, just return view_func(view_args). Duh. > > On Sep 16, 1:37 pm, intrepidweb <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > I'm w

Re: Translations are not linkable, middleware to insert Language code in the URL

2008-10-09 Thread Frantisek Malina
I found it at http://code.google.com/p/django-localeurl/ More context: http://groups.google.com/group/django-developers/browse_thread/thread/3417b90f0e6fda9f http://www.satchmoproject.com/trac/ticket/459 --~--~-~--~~~---~--~~ You received this message because you

Translations are not linkable, middleware to insert Language code in the URL

2008-10-09 Thread Frantisek Malina
Django native translation functionality will get the preferred language from the user's device. Than it will give the user application (and possibly content) in the user's language on the same URL. Is there a middleware that would put the language iso-alpha-2 code in the URL if tha

Re: Google Analytics Cookies invalidating Caching Middleware

2008-09-29 Thread Malcolm Tredinnick
On Mon, 2008-09-29 at 16:32 -0700, Cortland Klein wrote: > I've enabled caching via UpdateCacheMiddleware and > FetchFromCacheMiddleware, placed at the beginning and end of > middleware, respectively. > > When loading a URL, I'm getting a Vary: Accept-Encodinge. &

Re: Google Analytics Cookies invalidating Caching Middleware

2008-09-29 Thread [EMAIL PROTECTED]
Er, I'm getting a Vary: Accept-Encoding,Accept-Language,Cookie header. On Sep 29, 4:32 pm, Cortland Klein <[EMAIL PROTECTED]> wrote: > When loading a URL, I'm getting a Vary: Accept-Encodinge. > > Vary: Accept-Encoding,Accept-Language,Cookie --~--~-~--~~~---~--~~ Y

Google Analytics Cookies invalidating Caching Middleware

2008-09-29 Thread Cortland Klein
I've enabled caching via UpdateCacheMiddleware and FetchFromCacheMiddleware, placed at the beginning and end of middleware, respectively. When loading a URL, I'm getting a Vary: Accept-Encodinge. Problem is, each page load Google Analytics keeps changing __utm(a,b,c,z) cookies,

Clash between file upload handler and middleware accessing request's dictionaries

2008-09-18 Thread Julien Phalip
Hi, Upload handlers cannot be set after the request's POST or FILES dictionaries have been accessed. The problem I'm having is that one of the middleware I use (packaged with the django-pagination app) actually accesses request.REQUEST when the request comes in. Therefore it is imp

Re: Custom middleware: using process_view to modify the view_func

2008-09-17 Thread intrepidweb
idweb <[EMAIL PROTECTED]> wrote: > Hi there, > > I'm working on a custom middleware class for the first time. My goal > is to write a process_view function that modifies the view_func and/or > view_args that were passed in. > > The documentation states that proces

Custom middleware: using process_view to modify the view_func

2008-09-16 Thread intrepidweb
Hi there, I'm working on a custom middleware class for the first time. My goal is to write a process_view function that modifies the view_func and/or view_args that were passed in. The documentation states that process_view can either return None or an HttpResponse. But is there a way to m

<    1   2   3   4   5   6   7   >