Ahhhh I see
ok so I tried putting
auth.settings.login_url =URL('index', args='login')
auth.settings.logged_url = URL('index', args='profile')
in my model
but i end up with the error
SyntaxError: not enough information to build the url
On Aug 12, 7:59 pm, mdipierro <[email protected]> wrote:
> because I like that there is a trace of conversation. Here there is a
> trace.
>
> I would put that in the model after you define auth.
>
> On Aug 12, 6:56 pm, thedangler <[email protected]> wrote:
>
>
>
> > does this
>
> > auth.settings.login_url =URL('index', args='login')
> > auth.settings.logged_url = URL('index', args='profile')
>
> > go in the default controller in the index or in the view?
>
> > also why are you not in IRC freenode in web2py conversations would
> > happen alot faster :)
>
> > thanks for the help
>
> > On Aug 12, 7:42 pm, mdipierro <[email protected]> wrote:
>
> > > no problem. Your problem is here:
>
> > > <h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2>
>
> > > since when you callhttp://.../index, request.args(0) is None and you
> > > cannot call .replace. Moreover "request.args(0).replace('_','
> > > ').capitalize()" is not a constant a string but a string that depends
> > > on user input and it should not be translated using T or you introduce
> > > a vulnerability.
>
> > > Now I see what you want to do. You are using the index() action as a
> > > replacement for the user() action.
>
> > > You can put form=auth() back but you also have to do:
>
> > > auth.settings.login_url =URL('index', args='login')
> > > auth.settings.logged_url = URL('index', args='profile')
>
> > > and replace the line above with
>
> > > <h2>{{=(request.args(0) or 'login').replace('_',' ').capitalize()}}</
> > > h2>
>
> > > On Aug 12, 6:36 pm, thedangler <[email protected]> wrote:
>
> > > > sorry about the formatting.. it looks like crap
>
> > > > On Aug 12, 7:36 pm, thedangler <[email protected]> wrote:
>
> > > > > default controller
> > > > > def index():
> > > > > """
> > > > > example action using the internationalization operator T and
> > > > > flash
> > > > > rendered by views/default/index.html or views/generic.html
> > > > > """
> > > > > response.flash = T('Welcome to web2py')
> > > > > return dict(message=T('Welcome to MyApp'),form=auth.login())
> > > > > default/index.html
> > > > > {{extend 'layout.html'}}
> > > > > <div class="container">
> > > > > {{if 'message' in globals():}}{{=H2(message)}}{{else:}}
> > > > > {{=BEAUTIFY(response._vars)}}{{pass}}
> > > > > <div class="span-18 colborder">
> > > > > test text for site
> > > > > <img src="/myapp/static/images/bewoost_flow.png" />
> > > > > </div>
> > > > > <div class="span-4">
> > > > > <h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2>
> > > > > {{=form}}
> > > > > {{if request.args(0)=='login':}}
> > > > > {{if not 'register' in auth.settings.actions_disabled:}}
> > > > > <br/><a href="{{=URL(r=request,args='register')}}">register</a>
> > > > > {{pass}}
> > > > > {{if not 'request_reset_password' in
> > > > > auth.settings.actions_disabled:}}
> > > > > <br/><a href="{{=URL(r=request,args='request_reset_password')}}">lost
> > > > > password</a>
> > > > > {{pass}}
> > > > > {{pass}}
> > > > > </div>
> > > > > </div>
> > > > > Traceback (most recent call last):
> > > > > File "gluon/restricted.py", line 178, in restricted
> > > > > File "path/to/app/applications/myapp/views/default/index.html",
> > > > > line
> > > > > 52, in <module>
> > > > > AttributeError: 'NoneType' object has no attribute 'replace'
>
> > > > > On Aug 12, 7:08 pm, mdipierro <[email protected]> wrote:
>
> > > > > > Please post your complete function, the view and the complete
> > > > > > traceback. Some setting must be wrong.
>
> > > > > > On Aug 12, 5:37 pm, thedangler <[email protected]> wrote:
>
> > > > > > > Im so lost. I tried changing form=auth() to form=auth.login() but
> > > > > > > i
> > > > > > > just get error AttributeError: 'NoneType' object has no attribute
> > > > > > > 'replace'
>
> > > > > > > Sorry this my first time using web2py
>
> > > > > > > Matt
>
> > > > > > > On Aug 12, 6:20 pm, mdipierro <[email protected]> wrote:
>
> > > > > > > > form=auth() generates forms depending on the context. If it
> > > > > > > > determines
> > > > > > > > that the current user is not logged in it redirects you to what
> > > > > > > > it
> > > > > > > > thinks is the login url. Do you wish to include a login form?
> > > > > > > > If you
> > > > > > > > you need form=auth.login()
>
> > > > > > > > On Aug 12, 5:05 pm, thedangler <[email protected]> wrote:
>
> > > > > > > > > in my index controller I have return dict(message=T('Welcome
> > > > > > > > > to
> > > > > > > > > Bewoost'),form=auth());
>
> > > > > > > > > And because I added form=auth() to the dict my index url
> > > > > > > > > changes from
> > > > > > > > > domain.com/appname to domain.com/appname/default/user/login
>
> > > > > > > > > How and why does it do that.
>
> > > > > > > > > How can I make it not do that.
>
> > > > > > > > > I tried doing
>
> > > > > > > > > auth.settings.login_url = URL('user', args='login') but i
> > > > > > > > > just get an
> > > > > > > > > error plus i dont even know where to put it.
>
> > > > > > > > > thanks