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">
      The fastest way to be updated only for things you are interested
in.
      <img src="/myapp/static/images/bewoost_flow.png" />
  </div>
  <div class="span-4">
<h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2>
{{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

Reply via email to