librelist archives

« back to archive

redirect gives error

redirect gives error

From:
Weasky
Date:
2010-07-18 @ 05:57
Hi, I love Flask and would like to use it in a small project.
I have an app.py and a module project.py
in app.py I have an index view.
in project.py I use:

mod = Module(__name__, name='projects', url_prefix='/projects')
@mod.route('/',methods = ['GET','POST'])
def index():
    if request.method == 'GET':
         return render_template('projects.html', projects=projects)
    else:
        redirect(request.referrer or url_for('.index'))

then it gives "raise ValueError('View function did not return a response')".
Tried to change the code to 'redirect('/')', no help.

any advice is welcome. thanks!

-- 
Weller
Enjoy everyday life!

Re: [flask] redirect gives error

From:
何威威
Date:
2010-07-18 @ 06:31
redirect(request.referrer or url_for('.index')) here should be    return
redirect(request.referrer or url_for('.index'))    because redirect is a
response too.

2010/7/18 Weasky <weasky@gmail.com>

> Hi, I love Flask and would like to use it in a small project.
> I have an app.py and a module project.py
> in app.py I have an index view.
> in project.py I use:
>
> mod = Module(__name__, name='projects', url_prefix='/projects')
> @mod.route('/',methods = ['GET','POST'])
> def index():
>     if request.method == 'GET':
>          return render_template('projects.html', projects=projects)
>     else:
>         redirect(request.referrer or url_for('.index'))
>
> then it gives "raise ValueError('View function did not return a
> response')". Tried to change the code to 'redirect('/')', no help.
>
> any advice is welcome. thanks!
>
> --
> Weller
> Enjoy everyday life!
>

Re: [flask] redirect gives error

From:
weasky
Date:
2010-07-18 @ 13:47
Thanks! it works perfectly.



On Sun, Jul 18, 2010 at 2:31 AM, 何威威 <heww0205@gmail.com> wrote:

> redirect(request.referrer or url_for('.index')) here should be    return
> redirect(request.referrer or url_for('.index'))    because redirect is a
> response too.
>
> 2010/7/18 Weasky <weasky@gmail.com>
>
> Hi, I love Flask and would like to use it in a small project.
>> I have an app.py and a module project.py
>> in app.py I have an index view.
>> in project.py I use:
>>
>> mod = Module(__name__, name='projects', url_prefix='/projects')
>> @mod.route('/',methods = ['GET','POST'])
>> def index():
>>     if request.method == 'GET':
>>          return render_template('projects.html', projects=projects)
>>     else:
>>         redirect(request.referrer or url_for('.index'))
>>
>> then it gives "raise ValueError('View function did not return a
>> response')". Tried to change the code to 'redirect('/')', no help.
>>
>> any advice is welcome. thanks!
>>
>> --
>> Weller
>> Enjoy everyday life!
>>
>
>

Flask-Openid app engine

From:
Carles
Date:
2010-07-18 @ 11:34
Hi, anyone used flask-openid on app engine? It could be possible without a
filesystem?

Carles

El 18/07/2010, a las 08:31, "何威威" <heww0205@gmail.com> escribió:

> redirect(request.referrer or url_for('.index')) here should be    return
redirect(request.referrer or url_for('.index'))    because redirect is a 
response too.
> 
> 2010/7/18 Weasky <weasky@gmail.com>
> Hi, I love Flask and would like to use it in a small project.
> I have an app.py and a module project.py
> in app.py I have an index view.
> in project.py I use:
> 
> mod = Module(__name__, name='projects', url_prefix='/projects')
> @mod.route('/',methods = ['GET','POST'])
> def index():
>     if request.method == 'GET':
>          return render_template('projects.html', projects=projects)
>     else:
>         redirect(request.referrer or url_for('.index'))
> 
> then it gives "raise ValueError('View function did not return a 
response')". Tried to change the code to 'redirect('/')', no help.
> 
> any advice is welcome. thanks!
> 
> -- 
> Weller
> Enjoy everyday life!
> 

Re: [flask] Flask-Openid app engine

From:
Armin Ronacher
Date:
2010-07-18 @ 11:41
Hi,

On 7/18/10 1:34 PM, Carles wrote:
> Hi, anyone used flask-openid on app engine? It could be possible without
> a filesystem?
Yes, but you would have to write yourself a custom store.


Regards,
Armin

Re: [flask] Flask-Openid app engine

From:
Carles Gonzalez
Date:
2010-07-18 @ 14:25
Thanks! I'll try.

On Sun, Jul 18, 2010 at 1:41 PM, Armin Ronacher <armin.ronacher@active-4.com
> wrote:

> Hi,
>
> On 7/18/10 1:34 PM, Carles wrote:
> > Hi, anyone used flask-openid on app engine? It could be possible without
> > a filesystem?
> Yes, but you would have to write yourself a custom store.
>
>
> Regards,
> Armin
>

Re: [flask] Flask-Openid app engine

From:
Date:
2010-07-18 @ 12:01
App engine users service now has openid built in. Check the docs. 
Sent via BlackBerry by AT&T

-----Original Message-----
From: Carles <carlesgm@gmail.com>
Sender: flask@librelist.com
Date: Sun, 18 Jul 2010 13:34:29 
To: <flask@librelist.com>
Reply-To: flask@librelist.com
Subject: [flask] Flask-Openid app engine

Hi, anyone used flask-openid on app engine? It could be possible without a
filesystem?

Carles

El 18/07/2010, a las 08:31, "何威威" <heww0205@gmail.com> escribió:

> redirect(request.referrer or url_for('.index')) here should be    return
redirect(request.referrer or url_for('.index'))    because redirect is a 
response too.
> 
> 2010/7/18 Weasky <weasky@gmail.com>
> Hi, I love Flask and would like to use it in a small project.
> I have an app.py and a module project.py
> in app.py I have an index view.
> in project.py I use:
> 
> mod = Module(__name__, name='projects', url_prefix='/projects')
> @mod.route('/',methods = ['GET','POST'])
> def index():
>     if request.method == 'GET':
>          return render_template('projects.html', projects=projects)
>     else:
>         redirect(request.referrer or url_for('.index'))
> 
> then it gives "raise ValueError('View function did not return a 
response')". Tried to change the code to 'redirect('/')', no help.
> 
> any advice is welcome. thanks!
> 
> -- 
> Weller
> Enjoy everyday life!
> 

Re: [flask] Flask-Openid app engine

From:
liuliang
Date:
2010-07-18 @ 11:58
you can have a try about rpx <http://www.janrain.com>