middleware

2011-07-13 Thread NISA BALAKRISHNAN
how to write a middleware that that stores all database requests. How can i store all database requests? pls help -- 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@googlegrou

middleware

2013-05-09 Thread Anderson
Does anyone know if is possible execute a middleware only to a specific application or url? -- Anderson Dias Borges Senior Analyst Developer Tu cumprirás o desejo do meu coração se eu Te buscar... I can't see but I'll take my chances To hear You call my name -- You received th

middleware

2015-08-25 Thread Pawanesh Gautam
why middleware is required ?? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, sen

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

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

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

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

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

middleware question

2010-04-20 Thread Tim Arnold
Hi, I want to serve some raw xml files, but add a stylesheet to the response so the user can view it better. The raw xml begins like this: http://docbook.org/ns/docbook"; version="5.0"> etc. I want to create some middleware to serve them like this: http://docb

Re: middleware

2011-07-14 Thread Calvin Spealman
You should use Django Debug Toolbar. It can handle this sort of thing, and many other things, for you. On Thu, Jul 14, 2011 at 1:34 AM, NISA BALAKRISHNAN wrote: > how to write a middleware that that stores all database requests. > How can i store all database requests? > > pls help

Middleware order

2012-05-15 Thread David
Hi This is how my middleware is currently ordered: 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.gzip.GZipMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django

SOPA middleware

2012-01-18 Thread Gabriel Gunderson
Django peeps, I know it's a little late to make much use of the code, but I thought I'd mention it anyway... See the SOPA middleware in action (will auto-heal tonight): http://izeni.com/ Download it: http://dl.dropbox.com/u/47654226/sopa_protest.tar.gz It was quickly hacked toget

Re: middleware

2013-05-09 Thread Shawn Milochik
In your middleware you'll have access to the request object, so you can easily check the URL, user, etc. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an e

Re: middleware

2013-05-10 Thread Hristo Deshev
> > Does anyone know if is possible execute a middleware only to a specific > > application or url? On 05/09/2013 04:56 PM, Shawn Milochik wrote: > In your middleware you'll have access to the request object, so you can > easily check the URL, user, etc. I'd consi

Re: middleware

2013-05-13 Thread Bill Freeman
hev wrote: > > > Does anyone know if is possible execute a middleware only to a > specific application or url? > > On 05/09/2013 04:56 PM, Shawn Milochik wrote: > > In your middleware you'll have access to the request object, so you can > > easily check the URL, user, e

middleware question

2013-05-25 Thread Marcin Szamotulski
Dear Django Gurus, I have a simple question about middleware. I have a middleware object which looks like this: class MyMiddleware(object): def process_view(...): ... self.data = some data ... def process_template_response(...): data

Middleware + Transactions

2015-01-30 Thread Thomas Güttler
as suggested here http://django-reversion.readthedocs.org/en/latest/api.html#revisionmiddleware is quite not feasible for large projects. Especially given that reversion is not the only middleware that needs to be executed within the same transaction as the view function. It would basically mean

Email Middleware

2015-07-08 Thread Stefano Probst
Hello, i search for a universal way to modify the content of a mail before send it. Is there a middleware like system for mails? Background: I want to program a system which encrypt outgoing mails via PGP. Best regard Stefano -- You received this message because you are subscribed to the

Re: middleware

2015-08-25 Thread Mayank G
Middleware allows you to process certain pre specified activities like, Logging, User Authentication, Tokenization and filtration of data. Route authentication, Access control list validations. It provides flexibility to invoke appropriate middleware on different routes. These act as glue to

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

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(

Middleware sessions

2007-02-02 Thread kbochert
After a long absence, I tried my installation of the tutorial and got: Error importing middleware django.middleware.sessions My settings.py has: MIDDLEWARE _CLASSES = { --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Middleware sessions

2007-02-02 Thread kbochert
After a long absence, I tried my installation of the tutorial and got: Error importing middleware django.middleware.sessions My settings.py has: MIDDLEWARE _CLASSES = { "django.middleware.sessions.SessionMiddleware", ... I change this to : MIDDLEWAR

Redirect middleware

2007-04-23 Thread plungerman
greetings, i am attempting to do a simple redirect using django's redirect middleware. everything works fine if you want to redirect from one distinct URI to another, for example, /big/ ---> http://www.example.com/labowski/ however, if you want to redirect to a child page in terms of

Maintainance Middleware

2007-05-15 Thread Christian M Hoeppner
Hi there! How would one handle the following tasks in a middleware? If a settings called "MAINTENANCE" is true, check if the user is logged in. If he is, let him view the requested page normally. If not, redirect to maintenance page. If setting is false, show page normally de

middleware needed

2005-09-11 Thread lawgon
param_dict) File "/usr/local/lib/python2.4/site-packages/django/middleware/admin.py", line 41, in process_view assert hasattr(request, 'session'), "The admin requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.middl

SSL Middleware

2006-10-06 Thread Antonio Cavedoni
Hello everyone, yesterday I came up with a Django middleware that has the potential to be actually useful! I called it SSL Middleware, and what it does is take a tuple of paths (HTTPS_PATHS in the settings file) and redirect all the http:// requests for paths starting with these values to

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

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

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

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

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

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

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 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

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

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

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

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

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,

order of middleware

2010-08-26 Thread Alessandro Ronchi
Is this middleware classes correctly ordered for performance? thanks in advance, MIDDLEWARE_CLASSES = ( "django.middleware.common.CommonMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middlewar

Middleware for models

2010-02-12 Thread pbzRPA
ricky part is that it's becoming a lot of maintenance to check in each view if the record was created by the user or not. I wrote a normal middleware that adds the users unique site to the request. This helps with having the user site in each view but I was wondering how I could get the user s

Re: middleware question

2010-04-20 Thread Peter Landry
That will add a header to the http response, not an element to the text of the xml output. There may be an easier way to do what you want with a middleware, but the only thing I can think of is to basically prepend your desired xml header to the response text and create a new HttpResponse with

Re: Middleware order

2012-05-15 Thread Furbee
I don't know, but the revision middleware smells like it could be the culprit. It is the last module in processing the request, and the first one processing the response back up the chain. Maybe it is returning the old data. Just a stab in the dark. Furbee On Tue, May 15, 2012 at 8:23 AM,

Login Required Middleware

2012-07-30 Thread Blaxton
Hi I am trying to use login required middleware in a project and followed every step mentioned on following url , but its just not working. http://djangosnippets.org/snippets/1179/ placed the above middleware in myproject/middleware.py added following lines to settings.py LOGIN_URL

problem with middleware

2011-09-28 Thread jenia ivlev
Hello: I have defined a middleware class. and i have added it to the middleware_classes attribute in setting. When a request comes in, the middleware class gets created (the debugger catches the code when the breakpoint is on the class CommonFiilter(): line) Now i expect the function def

Re: middleware question

2013-05-25 Thread Marcin Szamotulski
I did some test myself and the best thing what I can do is to attach data to the request since its live cycle is what I actually need. Best regards, Marcin On 14:20 Sat 25 May , Marcin Szamotulski wrote: > Dear Django Gurus, > > I have a simple question about middleware.

Re: Email Middleware

2015-07-09 Thread Stefano Probst
I implement the software now as a custom email backend . My backend manipulate the content of the message and act as wrapper for the real mail backend. -- You received this message because you are subscribed

New-style middleware

2016-11-22 Thread Torsten Bronger
Hallöchen! Considering the following old-style middleware class: class ExceptionsMiddleware: def process_exception(self, request, exception): ... I convert this to new-style middleware by inserting two methods: class ExceptionsMiddleware: def __init__(self

Cache middleware problem

2014-12-18 Thread T Kwn
I have a list view where I can add or delete objects. I found that if the cache middleware is included: 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware' The page doesn't operate properly. Basically deleted objects don&#

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

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

browser detection middleware

2007-05-22 Thread omat
Hi all, 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 know this is mostly done by

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

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

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: 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

Re: Middleware sessions

2007-02-02 Thread Joseph Heck
As of the "magic removal" (the bits just prior to the 0.95 release), sessions was moved into contrib. -joe On 2/2/07, kbochert <[EMAIL PROTECTED]> wrote: > > > After a long absence, I tried my installation of the tutorial and got: > > Error importing middleware dj

Transaction middleware + Filesystem

2007-02-02 Thread Paul Collier
if it happens inside several layers of function calls this becomes difficult. Is there some sort of common Django or Python idiom for this sort of thing, an easy way to add hooks to the transaction middleware, or should I just stop being so paranoid about consistency? ;) Thanks! -

SQL Debug middleware

2007-04-21 Thread Jesse Lovelace
Hey all, I made this the other day to help me track all the sql statements my pages were doing. I wanted something unobtrusive (i.e. middleware) and simple. Hope you like: from django.db import connection import re, pprint body_end = re.compile('', re.IGNORECASE) class Debug

Re: Redirect middleware

2007-04-23 Thread Michael K
On Apr 23, 10:13 am, plungerman <[EMAIL PROTECTED]> wrote: > greetings, > > i am attempting to do a simple redirect using django's redirect > middleware. everything works fine if you want to redirect from one > distinct URI to another, for example, > > /big/ ---

Re: Redirect middleware

2007-04-23 Thread plungerman
ve for viewing. i suspect that something is going wrong in that department. what do you think? On Apr 23, 5:06 pm, Michael K <[EMAIL PROTECTED]> wrote: > On Apr 23, 10:13 am, plungerman <[EMAIL PROTECTED]> wrote: > > > > > greetings, > > > i am attemp

Re: Redirect middleware

2007-04-23 Thread oggie rob
> > (r'^%s(?P[^?#]*)' % (root_url), 'apps.cms.views.render'), > Note that '?' is a special character, but more importantly your expression probably matches both the initial request and the redirected one. Check it out: >>> r = re.compile('/about/(?P[^?#]*)') >>> r.match('/about/?user1') <_sre.SRE

Re: Redirect middleware

2007-04-24 Thread plungerman
hi rob, i think you are on to something there. i should familiarise myself more with reg ex, certainly one of my weaknesses. basically what we want to match on is anything from the root_uri ("/") to the end of the path. so about/mydir/user1/ would be passed to our view for munging. i kind of

Re: Redirect middleware

2007-04-26 Thread Laurie Harper
oggie rob wrote: >> (r'^%s(?P[^?#]*)' % (root_url), 'apps.cms.views.render'), > Note that '?' is a special character, ... Nope; it's special outside a character class ([...]), but in a character class ? has no special meaning. L. --~--~-~--~~~---~--~~ You recei

Re: Redirect middleware

2007-04-26 Thread oggie rob
On Apr 26, 12:16 pm, Laurie Harper <[EMAIL PROTECTED]> wrote: > oggie rob wrote: > >> (r'^%s(?P[^?#]*)' % (root_url), 'apps.cms.views.render'), > > Note that '?' is a special character, ... > > Nope; it's special outside a character class ([...]), but in a character > class ? has no special meanin

Re: Maintainance Middleware

2007-05-15 Thread Jeremy Dunck
On 5/15/07, Christian M Hoeppner <[EMAIL PROTECTED]> wrote: > > Hi there! > > How would one handle the following tasks in a middleware? Put this somewhere in your app: == class MaintenanceMiddleware(object): def process_request(self, request): from django.conf import

Re: Maintainance Middleware

2007-05-15 Thread [EMAIL PROTECTED]
> Hi there! > > How would one handle the following tasks in a middleware? > > If a settings called "MAINTENANCE" is true, check if the user is logged in. > If > he is, let him view the requested page normally. If not, redirect to > maintenance page. &

Re: Maintainance Middleware

2007-05-15 Thread Christian M Hoeppner
ENANCE: > if not request.user.is_authenticated(): > return HttpResponseRedirect('/maintenance/') > return None > > Put this middleware after AuthenticationMiddleware in the settings.py Of course, this would work, but it also prevents users not logg

Re: Maintainance Middleware

2007-05-15 Thread Jeremy Dunck
der maintenance? You're more likely to get working code if all the requirements are stated. :) Set these settings: LOGIN_REDIRECT_URL LOGIN_URL LOGOUT_URL Then the middleware would be: class MaintenanceMiddleware(object): def process_request(self, request): from django.conf imp

Re: Maintainance Middleware

2007-05-16 Thread Christian M Hoeppner
> You're more likely to get working code if all the requirements are stated. > :) Yeah, you're right, Jeremy. Thank you a lot for your help. I wonder... There isn't a way in a middleware to access some name path from the urlconf, is there? That way I wouldn't have

Re: Maintainance Middleware

2007-05-16 Thread Jeremy Dunck
On 5/16/07, Christian M Hoeppner <[EMAIL PROTECTED]> wrote: ... > I wonder... There isn't a way in a middleware to access some name path from > the urlconf, is there? That way I wouldn't have to set those settings, by > letting the admin-path bypass the maintenance mid

Re: Maintainance Middleware

2007-05-16 Thread Christian M Hoeppner
Just for the record: ** settings.py in $project_path: # Maintenance Mode Switch MAINTENANCE = True # Login paths LOGIN_REDIRECT_URL = '/admin/' LOGIN_URL = '/admin/' LOGOUT_URL = '/admin/logout/' # This will be shown to unauthorised users when the site is in maintenance mode MAINTENANCE_PATH

Re: middleware needed

2005-09-11 Thread Eugene Lazutkin
quot;, > line 60, in get_response >response = middleware_method(request, callback, param_dict) > > File > "/usr/local/lib/python2.4/site-packages/django/middleware/admin.py", > line 41, in process_view > assert hasattr(request, 'session'), "The admin re

Validator app+middleware

2005-11-18 Thread Luke Plant
Hi all, This evening I wrote an app and middleware to help me with development of my Django project. It validates all the HTML generated by your Django project, and logs any failures, including the original request object, the response object and the errors. It's more useful than a cr

mproperlyConfigured: Middleware module

2006-06-27 Thread Patrick Martini
dpython.py", line 128, in __call__ self.load_middleware() File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py", line 36, in load_middleware raise exceptions.ImproperlyConfigured, 'Middleware module "%s" does not define a "%s"

Problem with middleware

2006-07-09 Thread Guillermo Fernandez Castellanos
last visit (30 minutes, 1 hour, 1day,... that can be choosen). I've decided to keep in the cookies, through the session middleware, the value of the last visit. I do this with the request.session in the process_view of a personal middleware I am trying to develop: class IpMiddleware:

Re: SSL Middleware

2006-10-07 Thread [EMAIL PROTECTED]
looks handy! so now we can specify our urls for, say a login screen, and enjoy ssl for that page only without explicit redirects. Also there is no way for a user to request an unsecure version of that page if one is not explicitly offered. --~--~-~--~~~---~--~~ Y

Re: SSL Middleware

2006-10-09 Thread Antonio Cavedoni
ffered. Yes, unless they find a way to work around the middleware, that is ;-) This also means there is no ambiguity over the canonical URI of a page. I’m thinking about modifying the HTTPS_PATHS setting to accept regular expressions instead of just strings, that would allow for even more flex

Re: SSL Middleware

2006-10-09 Thread mukappa
Very timely. I was just looking for something like this. One observation. When redirecting to https elsewhere in the django code I see this call, "django.http.get_host(request)" for resolving the host portion. Thanks. --~--~-~--~~~---~--~~ You received this me

Re: SSL Middleware

2006-10-10 Thread Antonio Cavedoni
just request.META['HTTP_HOST'] as I’m doing. I tweaked the SSL middleware to use it, thanks for the heads up! Cheers. -- Antonio --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" g

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,

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-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

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: 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

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 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-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-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-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

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: 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

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

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: 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, 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

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

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

  1   2   3   4   5   6   7   >