Thank you for letting us know. It is always good to report and discuss
a problem even if it turns out to be nothing because some times it is
not nothing and something needs to be fixed.

Massimo

On 1 Lug, 13:08, elfuego1 <[email protected]> wrote:
> Finally! Happy news.
> I have found an error. It was my fault.
>
> In db.py I had defined mysql database connection... TWICE.
> Once for auth_user table and second time for all the other tables I
> added myself.
> So in administration panel I had seen only the tables I had added
> myself and none of auth_ tables.
>
> Thank you for your time!!! And patience with me.
> Now everything works as it should.
>
> Your input was priceless. Thanks a LOT!!!!!!!
>
> Best regards.
>
> On 1 Lip, 07:59, mdipierro <[email protected]> wrote:
>
> > \applications\\myapplication/controllers/default.py", line 64, in
> > ajaxuserexist\n  File "gluon/sql.py", line 1329, in __getattr__
> > \nKeyError: \'auth_user\'\n'
>
> > What is in default.py line 60-70?
>
> > I think it tells that db.auth_useris not defined. Something is wrong
> > in the models then.
>
> > On 30 Giu, 16:30, elfuego1 <[email protected]> wrote:
>
> > > OK. Now I can see an error:
> > > POSThttp://127.0.0.1:8000/myapplication/default/ajaxuserexist 500
> > > INTERNAL SERVER ERROR
>
> > > There is also information about issued ticet but I can't open it in
> > > web browser, so I paste it below:
>
> > > (dp1
> > > S'output'
> > > p2
> > > S''
> > > sS'layer'
> > > p3
> > > S'F:\\Programy\\web2py\\applications\\myapplication/controllers/
> > > default.py'
> > > p4
> > > sS'code'
> > > p5
> > > S'# -*- coding: utf-8 -*-\n
> > > \n#########################################################################
> > > \n## This is a samples controller\n## - index is the default action of
> > > any application\n## - user is required for authentication and
> > > authorization\n## - download is for downloading files uploaded in the
> > > db (does streaming)\n## - call exposes all registered services (none
> > > by default)
> > > \n#########################################################################
> > > \n\ndef index():\n    """\n    example action using the
> > > internationalization operator T and flash\n    rendered by views/
> > > default/index.html or views/generic.html\n    """\n    response.flash
> > > = T(\'Welcome to web2py\')\n    return dict(message=T(\'Hello World\'))
> > > \n\n\ndef user():\n    """\n    exposes:\n    
> > > http://..../[app]/default/user/login\nhttp://..../[app]/default/user/logout\n
> > >     
> > > http://..../[app]/default/user/register\nhttp://..../[app]/default/user/profile\n
> > >     
> > > http://..../[app]/default/user/retrieve_password\nhttp://..../[app]/default/user/change_password\n
> > >     use
> > > @auth.requires_login()\n       �[email protected]_membership(\'group name
> > > \')\n       �[email protected]_permission(\'read\',\'table name
> > > \',record_id)\n    to decorate functions that needaccesscontrol\n
> > > """\n    return dict(form=auth())\n\n\ndef download():\n    """\n
> > > allows downloading of uploaded files\n    
> > > http://..../[app]/default/download/[filename]\n
> > > """\n    return response.download(request,db)\n\n\ndef call():\n
> > > """\n    exposes services. for example:\n    
> > > http://..../[app]/default/call/jsonrpc\n
> > > decorate with @services.jsonrpc the functions to expose\n    supports
> > > xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv\n    """\n
> > > session.forget()\n    return service()\n\n\n\ndef page2():\n    name =
> > > request.vars.login\n    #db.auth_user.insert(name=name)\n    return
> > > dict(name=name)\n\ndef ajaxuserexist():\n      username =
> > > request.vars.values()[0]\n      return
> > > db(db.auth_user.login==username).count() and \'yes\' or \'no\'\n\n
> > > \nresponse._vars=response._caller(ajaxuserexist)\n'
> > > p6
> > > sS'traceback'
> > > p7
> > > S'Traceback (most recent call last):\n  File "gluon/restricted.py",
> > > line 178, in restricted\n  File "F:\\Programy\\web2py\\applications\
> > > \myapplication/controllers/default.py", line 67, in <module>\n  File
> > > "gluon/globals.py", line 96, in <lambda>\n  File "F:\\Programy\\web2py\
> > > \applications\\myapplication/controllers/default.py", line 64, in
> > > ajaxuserexist\n  File "gluon/sql.py", line 1329, in __getattr__
> > > \nKeyError: \'auth_user\'\n'
> > > p8
> > > s.
>
> > > On 30 Cze, 22:59, mdipierro <[email protected]> wrote:
>
> > > > I'd like to know if the console reports any error when the ajax
> > > > request is executed.
>
> > > > On 30 Giu, 15:31, elfuego1 <[email protected]> wrote:
>
> > > > > I have firebug installed. What do you want me to look for?
> > > > > You want to see some firebug output?
>
> > > > > On 30 Cze, 22:25, mdipierro <[email protected]> wrote:
>
> > > > > > I do not see anything wrong in this. Do you use firebug?
>
> > > > > > On 30 Giu, 15:18, elfuego1 <[email protected]> wrote:
>
> > > > > > > I hope I don't make your eyes bleed by puting all the code here 
> > > > > > > but
> > > > > > > there is no other way to show it to you.
> > > > > > > I made change only in one place of the code to gather "login" 
> > > > > > > value:
> > > > > > > {login:value}
> > > > > > > Oryginaly it was: {name:value}.
>
> > > > > > >  $.post("{{=URL(r=request,c='default',f='ajaxuserexist')}}",
> > > > > > > {login:value},function(result){
>
> > > > > > > Below is the whole content of index.html
>
> > > > > > > {{extend 'layout.html'}}
>
> > > > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> > > > > > >     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > > > > > > <html>
> > > > > > > <head>
> > > > > > >     <meta http-equiv="Content-type" content="text/html;
> > > > > > > charset=utf-8">
> > > > > > >     <title>Ajax User Validation with web2py by Martin Sagastume</
> > > > > > > title>
> > > > > > >     <style type="text/css">
> > > > > > >     <!--
> > > > > > >     body { font-family:Arial,Verdana,Sans-serif; }
>
> > > > > > >     input[type=text]{
> > > > > > >         font-size:12px;
> > > > > > >         color:#666666;
> > > > > > >         background-color:#ffffff;
> > > > > > >         padding-top:5px;
> > > > > > >         width:200px;
> > > > > > >         height:20px;
> > > > > > >         border:1px solid #999999;
> > > > > > >     }
>
> > > > > > >     #resultbox { font-size:11px; }
> > > > > > >     .msg { color:blue; }
> > > > > > >     .success { color:green; }
> > > > > > >     .error { color:red; }
> > > > > > >     //-->
> > > > > > >     </style>
> > > > > > >     <script type="text/javascript"
> > > > > > > src="{{=URL(r=request,c='static',f='jquery.js')}}"></script>
> > > > > > >     <script type="text/javascript">
>
> > > > > > >     var submit = false;
> > > > > > >     $(document).ready(function(){
> > > > > > >         $("form").submit(function() {
> > > > > > >             return submit;
> > > > > > >         });
> > > > > > >     });
>
> > > > > > >     function getData(value){
> > > > > > >         if(value != ""){
> > > > > > >             $
> > > > > > > ("#resultbox").removeClass().addClass('msg').text('Validating...').fadeIn(10);
> > > > > > >             
> > > > > > > $.post("{{=URL(r=request,c='default',f='ajaxuserexist')}}",
> > > > > > > {login:value},function(result){
> > > > > > >                 if(result=='yes'){
> > > > > > >                     $
> > > > > > > ("#resultbox").removeClass().addClass('error').text('Login already
> > > > > > > taken').fadeTo(900,1);
> > > > > > >                     submit = false;
> > > > > > >                 }else{
> > > > > > >                     $
> > > > > > > ("#resultbox").removeClass().addClass('success').text('Login is
> > > > > > > available for registration!').fadeTo(900,1);
> > > > > > >                     submit = true;
> > > > > > >                 }
> > > > > > >             });
> > > > > > >         }else{
> > > > > > >             
> > > > > > > $("#resultbox").removeClass().addClass('msg').text('This
> > > > > > > field is required');
> > > > > > >         }
> > > > > > >     }
>
> > > > > > >     </script>
> > > > > > > </head>
> > > > > > > <body>
> > > > > > >     <form id="form1" method="post" action="page2">
> > > > > > >         <label for="country">Login:</label><br />
> > > > > > >         <input type="text" id="login" name="login"
> > > > > > > onblur="getData(this.value)" /><br />
> > > > > > >         <div id="resultbox" class="msg"></div><br />
> > > > > > >         <input type="submit" id="bsubmit" name="bsubmit"
> > > > > > > value="Submit" />
> > > > > > >     </form>
> > > > > > > </body>
> > > > > > > </html>
>
> > > > > > > On 30 Cze, 22:12, mdipierro <[email protected]> wrote:
>
> > > > > > > > This should give you an error because the print(username) is 
> > > > > > > > outside
> > > > > > > > the funciton the function that defines username, after the 
> > > > > > > > function
> > > > > > > > returns. How are you passing the username to the ajax call? Did 
> > > > > > > > you
> > > > > > > > check with firebug that is calls the correct url?
>
> > > > > > > > On 30 Giu, 15:01, elfuego1 <[email protected]> wrote:
>
> > > > > > > > > There was NO error messages. The code just didn't work.
> > > > > > > > > After inserting:
> > > > > > > > > print repr(username) to default.py I got:
>
> > > > > > > > > # -*- coding: utf-8 -*-
>
> > > > > > > > > #########################################################################
> > > > > > > > > ## This is a samples controller
> > > > > > > > > ## - index is the default action of any application
> > > > > > > > > ## - user is required for authentication and authorization
> > > > > > > > > ## - download is for downloading files uploaded in the db 
> > > > > > > > > (does
> > > > > > > > > streaming)
> > > > > > > > > ## - call exposes all registered services (none by default)
> > > > > > > > > #########################################################################
>
> > > > > > > > > def index():
> > > > > > > > >     """
> > > > > > > > >     example action using the internationalization operator T 
> > > > > > > > > and flash
> > > > > > > > >     rendered by views/default/index.html or views/generic.html
> > > > > > > > >     """
> > > > > > > > >    
>
> ...
>
> leggi tutto

Reply via email to