librelist archives

« back to archive

Priority for before_request

Priority for before_request

From:
Jose Ayerdis
Date:
2013-02-17 @ 15:52
Is there a way to priorize before_request methods. For instance if I have a
plugin that comes with a before_request annotated function, is there some
way to force that function to be executed after my customs befores_requests
routines?

Sincerly yours,

[Jose Luis Ayerdis Espinoza]
Necronet.info |
LinkedIn<http://www.linkedin.com/pub/jose-luis-ayerdis-espinoza/28/7b4/704>|
Careers
StackOverflow <http://careers.stackoverflow.com/necronet>

Re: [flask] Priority for before_request

From:
Markus Unterwaditzer
Date:
2013-02-17 @ 16:33
On 2013-02-17 16:52, Jose Ayerdis wrote:
> Is there a way to priorize before_request methods. For instance if I
> have a plugin that comes with a before_request annotated function, is
> there some way to force that function to be executed after my customs
> befores_requests routines?
>
> Sincerly yours,
>
> [Jose Luis Ayerdis Espinoza]
> Necronet.info [1] | LinkedIn [2] | Careers StackOverflow [3]
>
> Links:
> ------
> [1] http://Necronet.info
> [2] http://www.linkedin.com/pub/jose-luis-ayerdis-espinoza/28/7b4/704
> [3] http://careers.stackoverflow.com/necronet

https://github.com/mitsuhiko/flask/blob/master/flask/app.py#L380

Since dictionaries have no order, i'd say no.
But i'd also say that you are doing it wrong if your before_request 
hooks depend on other ones.

-- Markus

Re: [flask] Priority for before_request

From:
Jose Ayerdis
Date:
2013-02-17 @ 17:08
I am aiming to validate first the format of the request since I only
allowed certaines mimes, and specific format in the body I wanted to do
that before flask-login call for loading the user, is not necesary
something I am depending on is more to not waste resources in loading a
user that won't passed the request validation phase. So to clear things out
currently

flask-login > load_user()
my_app > validate the request

And I wanted

my_app > validate the request
flask-login > load_user()

Anyway as I said was just me been picky

Sincerly yours,

[Jose Luis Ayerdis Espinoza]
Necronet.info |
LinkedIn<http://www.linkedin.com/pub/jose-luis-ayerdis-espinoza/28/7b4/704>|
Careers
StackOverflow <http://careers.stackoverflow.com/necronet>


2013/2/17 Markus Unterwaditzer <markus@unterwaditzer.net>

> On 2013-02-17 16:52, Jose Ayerdis wrote:
> > Is there a way to priorize before_request methods. For instance if I
> > have a plugin that comes with a before_request annotated function, is
> > there some way to force that function to be executed after my customs
> > befores_requests routines?
> >
> > Sincerly yours,
> >
> > [Jose Luis Ayerdis Espinoza]
> > Necronet.info [1] | LinkedIn [2] | Careers StackOverflow [3]
> >
> > Links:
> > ------
> > [1] http://Necronet.info
> > [2] http://www.linkedin.com/pub/jose-luis-ayerdis-espinoza/28/7b4/704
> > [3] http://careers.stackoverflow.com/necronet
>
> https://github.com/mitsuhiko/flask/blob/master/flask/app.py#L380
>
> Since dictionaries have no order, i'd say no.
> But i'd also say that you are doing it wrong if your before_request
> hooks depend on other ones.
>
> -- Markus
>