Login_next

262 views
Skip to first unread message

annet

unread,
Jun 9, 2009, 3:36:13 AM6/9/09
to web2py Web Framework
Massimo,

r992 did not fix the login_next problem.

In db.py I have:

auth.settings.login_url=URL(r=request,c='authentication',f='login')
auth.settings.login_next=URL(r=request,c='core',f='index')
auth.settings.logout_next=URL(r=request,c='default',f='index')

In 1.61.4 the first two worked, in 1.63.5 with r992 ...


When on default/index, I choose login from the menu and login I am
redirected to default/index instead of core/index.


When I expose a function from appadmin, I am redirected to login, when
I login I am redirected to: http://127.0.0.1:8000/admin/default/design/cms,
instead of core/index


I also bookmarked the login page. When I login I am redirect to core/
index. However, when I logout and login again, I am redirected to
default/index.


So only when I login from outside web2py the login_next works
correctly.


I am looking forward to a fix of this problem.

Annet.



mdipierro

unread,
Jun 9, 2009, 10:16:49 AM6/9/09
to web2py Web Framework
Right now there are two possibilities:

- if web2py redirects you to login, after login, login redirects you
to the referencing page
- if you go to the login page without redirection, after login, you go
to login_next

I think what you see is consistent with this behavior. Am I wrong?

Massimo

annet

unread,
Jun 9, 2009, 11:05:47 AM6/9/09
to web2py Web Framework
Massimo,


> Right now there are two possibilities:
>
> - if web2py redirects you to login, after login, login redirects you
> to the referencing page
> - if you go to the login page without redirection, after login, you go
> to login_next
>
> I think what you see is consistent with this behavior. Am I wrong?

No, you are right. What I would like is web2py to always go to the
page set in login_next , so its behaviour is consistent, and not
dependent on being redirected or not.

I hope this can be fixed.

Annet.



mdipierro

unread,
Jun 9, 2009, 12:40:20 PM6/9/09
to web2py Web Framework
I have an idea that may fix this. I will work on it tonight.

mdipierro

unread,
Jun 9, 2009, 7:17:08 PM6/9/09
to web2py Web Framework
Please try the version in trunk. No more request.env.referer.

Massimo

annet

unread,
Jun 10, 2009, 12:27:13 PM6/10/09
to web2py Web Framework
Massimo,

I tried the version in trunk. Problem solved, thanks!


Kind regards,

Annet

Fran

unread,
Jun 10, 2009, 2:41:35 PM6/10/09
to web2py Web Framework
On Jun 10, 12:17 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Please try the version in trunk. No more request.env.referer.

This was r897 right?

This has caused problems for my app :/

I have pages which have a List at the top of the page (created by
crud.select) & underneath a create form (created by crud.create).
With r896 & earlier, submitting a new record would refresh the List.
r897 & later need a manual refresh (URL bar otherwise it wants to
resubmit the form data)

This is reproduceable with the smallest controller like this:
def test():
items = crud.select(db.table)
form = crud.create(db.table)
return dict(items=items, form=form)

F

mdipierro

unread,
Jun 10, 2009, 2:48:59 PM6/10/09
to web2py Web Framework
Fran,

I do not think this is creating the problem. Crud is still redirecting
UNLESS you set crud.settings.keepvalues=True. If this what you are
doing?

Can you tell which lines causes the problem?

Massimo

Fran

unread,
Jun 10, 2009, 4:55:59 PM6/10/09
to web2py Web Framework
On Jun 10, 7:48 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I do not think this is creating the problem. Crud is still redirecting
> UNLESS you set crud.settings.keepvalues=True. If this what you are
> doing?

Yes, well done :)

Can this be made to just take effect on 'update' not 'create' forms?
(Didn't seem to work on create anyway)

F

mdipierro

unread,
Jun 10, 2009, 6:01:31 PM6/10/09
to web2py Web Framework
Actually keepvalues=True only works and makes sense for create forms.

Massimo

annet

unread,
Jun 11, 2009, 3:00:39 AM6/11/09
to web2py Web Framework
Fran,

No, the version in trunk that fixed my problem was r1016.


> I have pages which have a List at the top of the page (created by
> crud.select) & underneath a create form (created by crud.create).
> With r896 & earlier, submitting a new record would refresh the List.
> r897 & later need a manual refresh (URL bar otherwise it wants to
> resubmit the form data)


I have something similar, just the other way around first the form
then the table:

@auth.requires_membership('site_manager')
def crud_openinghour():
...
form=crud.create(db.openingstijd)
form[0][-1][1].append(INPUT(_type='reset',_value='Reset'))
form[0][-1][1].append(INPUT
(_type='button',_value='Cancel',_onclick="window.location='%s';"%URL
(r=request,f='index')))
records=db((db.openingstijd.bedrijf==auth.user.bedrijf)&
(db.openingstijd.dag==db.dag.id))\
.select(db.openingstijd.ALL,db.dag.dag,orderby=db.openingstijd.dag|
db.openingstijd.van_tijd)
return dict(form=form,records=records)


Version r1016 did not break this functionality.


Kind regards,

Annet.

Fran

unread,
Jun 11, 2009, 7:36:20 AM6/11/09
to web2py Web Framework
On Jun 11, 8:00 am, annet <annet.verm...@gmail.com> wrote:
> No, the version in trunk that fixed my problem was r1016.

I suspect this is an SVN revno?
Bzr is currently on 909

Since Bzr is the master repo, I think it's best to quote those
revno's.

> I have something similar, just the other way around first the form
> then the table:
-CUT-
> Version r1016 did not break this functionality.

As Massimo pointed out, this only breaks with:
crud.settings.keepvalues=True

F
Message has been deleted

annet

unread,
Jun 11, 2009, 9:42:42 AM6/11/09
to web2py Web Framework
Fran,

> I suspect this is an SVN revno?
> Bzr is currently on 909
> Since Bzr is the master repo, I think it's best to quote those
> revno's.


You are right, but ...

At this page: http://bazaar.launchpad.net/%7Emdipierro/web2py/devel/revision/897

How do I download the modified files and update web2py?

At http://code.google.com/p/web2py/source/detail?r=1016, I click the
affected file and on the next page I click view raw file, when it's
one file I save it as ... when it's an application it's automatically
downloaded and I unarchive it in the applications folder. I do not
know if this is the right way to proceed, but is works...


Kind regards,

Annet.
Reply all
Reply to author
Forward
0 new messages