[web2py] Re: logout error
Sorry I mean here: @auth.requires_login() @auth.requires_permission(request.function) def dashboard(): you should NOT have both. Perhaps this was causing the problem? On Saturday, 15 February 2014 09:15:18 UTC-6, ajith c t wrote: Hi Massimo, Thanks for the reply, but sorry to say this, but I didn't understand what you meant there, which function should have both. I wanted every user to have login and logout functions, thats why I didn't add auth.permission for them. And can you explain why it is giving 303 error. Is it something with the redirect(next). On Thursday, 13 February 2014 18:16:27 UTC+5:30, ajith c t wrote: Hi , I am using web2py 2.5.1-stable+timestamp.2013.06.06.15.39.19 in my production environment. I know it is old but thinking about the mysql and other folders and files structure changes I am little hesitant to update it. My problem is this. My logout function doesn't work properly. # Login function def login(): try: logger.debug(login page) form = auth.login() return dict(form = form) except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) @auth.requires_login() def index(): try: if auth.has_membership('root'): logger.debug(auth.user.first_name + : logged in) redirect(URL('default', 'usrMgr')) else: logger.debug(auth.user.first_name +: logged in) redirect(URL('dashboard')) except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) @auth.requires_login() @auth.requires_permission(request.function) def dashboard(): try: logger.info(dashboard) ###Some Code### except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) def logout(): try: logger.debug(logout) auth.logout(next=URL(r=request, c='default', f='login')) return dict() except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) The behavior is different in different browsers. In Chrome when I select logout from the dashboard page, it remains in the same page. When I select the developer tools and check the network the urls are logout, login, dashboard in order and its loaded from cache. But there is no problem in firefox. My problem is the logut function doesnt redirect to login page. When I clear the browser cache or delete all the sessions in the sessions folder, it works neatly. But when the session file or the cache gets filled up, everything goes wrong. Let me know if I wasn't specific, so I can clear this problem. Thanks and Regards, Ajith -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Special chars (like !) on ajax form.
Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] pass values in state parameter oauth
I am using google oauth login as explained here https://groups.google.com/forum/#!msg/web2py/fjpbFxRAGJM/pxvoBJKk2UkJ.. I am trying to use the state parameter to pass some additional values to google. As I understand we should get the values back in the response from google. My authentication is working fine and I am able to retrieve first name last name etc.. But I am not able toget the state values... Any ideas? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: CAS provider and registration
The first issue is that the client app that uses a cas provider only provides one option: to log in - in the top navigation bar. I think some users would be at a loss as to how to register since there is no explicit link. The second and third issues are with the cas provider login page. After the user follows the login link in the cas client app what they see in the cas provider app is the navigation bar that has a drop down menu that says Login. And they see two fields for entering their email and password and a single login button. So the second issue is that coming from the cas client page they can wrongly assume that the login drop down menu in the navigation bar of the cas provider app can only log them in (not register). A work around would be to use the default mode for the auth links in the nav bar which will show all the links (login, registration, lost password) on the nav bar (instead of a drop down). The third issue is with the single login button on the cas provider app. For consistency with the normal (not cas) login pages I think that instead of showing only one login button it would be more user-friendly if the login page in the cas provider displayed the same buttons underneath the email and password boxes - the login, register and lost password button - as the normal login page does. The fourth issue is that if the user is not registered and thus goes from the client app to the cas login page and from there to the cas registration page, after a successful registration they are not redirected to the cas client app. I think many users would not know how to return to the cas client app after the registration. On Sun, Feb 16, 2014 at 2:34 PM, Tim Richardson t...@growthpath.com.auwrote: As long as you allow users to register in your auth settings (and by default they can), there is a register option on the login menu of the cas screen. This is based on trunk. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Alexei Vinidiktov -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: CAS login doesn't seem to work in web2py 2.8.2
Filed a bug report https://code.google.com/p/web2py/issues/detail?id=1875thanks=1875ts=1392551348 On Sun, Feb 16, 2014 at 7:49 AM, Alexei Vinidiktov alexei.vinidik...@gmail.com wrote: I think I've come across a bug, and a nasty one too. I'm trying to make my apps work with cas authentication. The user can successfully register in the cas provider but when he tries to log in from the cas client app - i.e. he clicks on the login link in the cas client, is taken to the cas provider's log in page, enters his credentials and hits the login button - he gets this error message: type 'exceptions.IOError' [Errno 2] No such file or directory: '/cas/default/user/cas/serviceValidate?service= http://127.0.0.1:8001/app1/default/user/loginticket=ST-44b14b77-8ba7-4008-a629-6344d16a3179 ' Version web2py(tm)Version 2.8.2-stable+timestamp.2014.02.14.22.30.06PythonPython 2.7.5: /usr/local/opt/python/bin/python2.7 (prefix: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7) Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. Traceback (most recent call last): File /Users/alexei/Dev/web2py/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /Users/alexei/Dev/web2py/web2py/applications/app1/controllers/default.py http://127.0.0.1:8001/admin/default/edit/app1/controllers/default.py, line 78, in module File /Users/alexei/Dev/web2py/web2py/gluon/globals.py, line 385, in lambda self._caller = lambda f: f() File /Users/alexei/Dev/web2py/web2py/applications/app1/controllers/default.py http://127.0.0.1:8001/admin/default/edit/app1/controllers/default.py, line 40, in user return dict(form=auth()) File /Users/alexei/Dev/web2py/web2py/gluon/tools.py, line 1303, in __call__ return getattr(self, args[0])() File /Users/alexei/Dev/web2py/web2py/gluon/tools.py, line 2369, in login redirect(cas.login_url(next), File /Users/alexei/Dev/web2py/web2py/gluon/contrib/login_methods/cas_auth.py, line 66, in login_url current.session.token = self._CAS_login() File /Users/alexei/Dev/web2py/web2py/gluon/contrib/login_methods/cas_auth.py, line 98, in _CAS_login data = urllib.urlopen(url).read() File /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py, line 87, in urlopen return opener.open(url) File /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py, line 208, in open return getattr(self, name)(url) File /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py, line 463, in open_file return self.open_local_file(url) File /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py, line 477, in open_local_file raise IOError(e.errno, e.strerror, e.filename) IOError: [Errno 2] No such file or directory: '/cas/default/user/cas/serviceValidate?service=http://127.0.0.1:8001/app1/default/user/loginticket=ST-44b14b77-8ba7-4008-a629-6344d16a3179' -- Alexei Vinidiktov -- Alexei Vinidiktov -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
You are passing the password as a URL arg, and in web2py, URL args cannot include special characters. Instead, pass it as a query string variable: $.web2py.component(url + '?code=' + encodedURIComponent(org_code), 'org_form_target'); Anthony On Sunday, February 16, 2014 7:36:17 AM UTC-5, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
and what you expected ? :-P you built your function to post to an url like /base_url/whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=)and its generally NOT safe doing what you're doing. User input in web applications needs to be either validated before or properly escaped.usually you'd want base_url?something=escaped_value that you can retrieve later with response.vars.something On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
great, thanks . On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: and what you expected ? :-P you built your function to post to an url like /base_url/ whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=)and its generally NOT safe doing what you're doing. User input in web applications needs to be either validated before or properly escaped.usually you'd want base_url?something=escaped_value that you can retrieve later with response.vars.something On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to fix DAL, datetime error
did you alter the field definition ? SQLite has a big issue when dealing with columns whose type is altered. as a proof of concept, try deleting your database and let web2py recreate it, you shouldn't incur again in any problem. On Sunday, February 16, 2014 6:06:25 AM UTC+1, A36_Marty wrote: Problem: When I send a recordset to a grid that contains a datetime field, I get the following error: type 'exceptions.ValueError' invalid literal for int() with base 10: '16 04:59:22' The field is defined as: Field('last_updated', 'datetime') The current datetime is written to the field with the following function: last_updated=datetime.datetime.utcnow() Looking in sqlite directly, I see the following value: 2014-02-16 04:59:22 However, when I try to load the grid with that value in the column, I get the above error. If I empty the field to and reload the grid, it loads fine. Could someone point me in the right direction for working with datetimes in web2py... The proper way to store, retrieve them.Also, if the value I supplied above is invalid, why was it accepted by web2py's DAL? Many thanks in advance -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
ReferenceError: encodedURIComponent is not defined How do I define it? Do I have to import something? Thanks. On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote: great, thanks . On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: and what you expected ? :-P you built your function to post to an url like /base_url/ whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=)and its generally NOT safe doing what you're doing. User input in web applications needs to be either validated before or properly escaped.usually you'd want base_url?something=escaped_value that you can retrieve later with response.vars.something On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
This almost works (no error): encodeURIComponent (without the d). But it doesn't find it On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote: ReferenceError: encodedURIComponent is not defined How do I define it? Do I have to import something? Thanks. On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote: great, thanks . On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: and what you expected ? :-P you built your function to post to an url like /base_url/ whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=)and its generally NOT safe doing what you're doing. User input in web applications needs to be either validated before or properly escaped.usually you'd want base_url?something=escaped_value that you can retrieve later with response.vars.something On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: queries from tables
tried to simplyfied test the query in the shell but got no result (no error occured). e.g. In [4] : sum = db.purchase_detail.quantity.sum() print db().select(sum).first()[sum] In [5] : for row in db(db.product).select(): print row.name product0 product1 product2 In [6] : for row in db(db.purchase_detail).select(): print row.quantity 1 1 any idea how to achieve it? or perhaps i define it on the views, not in the controllers, is it affect the query result? thanks and best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
Sorry, should be encodeURIComponent. What do you mean it doesn't find it? On Sunday, February 16, 2014 8:52:06 AM UTC-5, Avi A wrote: This almost works (no error): encodeURIComponent (without the d). But it doesn't find it On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote: ReferenceError: encodedURIComponent is not defined How do I define it? Do I have to import something? Thanks. On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote: great, thanks . On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: and what you expected ? :-P you built your function to post to an url like /base_url/ whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=)and its generally NOT safe doing what you're doing. User input in web applications needs to be either validated before or properly escaped.usually you'd want base_url?something= escaped_value that you can retrieve later with response.vars.something On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Special chars (like !) on ajax form.
I mean that it displays the searching (the else part) and the query doesn't find it: org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: ... else: return 'searching..' if the password is just 123 it works. (and not 123!). On Sunday, February 16, 2014 4:35:55 PM UTC+2, Anthony wrote: Sorry, should be encodeURIComponent. What do you mean it doesn't find it? On Sunday, February 16, 2014 8:52:06 AM UTC-5, Avi A wrote: This almost works (no error): encodeURIComponent (without the d). But it doesn't find it On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote: ReferenceError: encodedURIComponent is not defined How do I define it? Do I have to import something? Thanks. On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote: great, thanks . On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: and what you expected ? :-P you built your function to post to an url like /base_url/ whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=)and its generally NOT safe doing what you're doing. User input in web applications needs to be either validated before or properly escaped.usually you'd want base_url?something= escaped_value that you can retrieve later with response.vars.something On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit
[web2py] Re: Special chars (like !) on ajax form.
You didn't update your controller code -- request.args(0) should now be request.vars.code. On Sunday, February 16, 2014 9:46:47 AM UTC-5, Avi A wrote: I mean that it displays the searching (the else part) and the query doesn't find it: org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: ... else: return 'searching..' if the password is just 123 it works. (and not 123!). On Sunday, February 16, 2014 4:35:55 PM UTC+2, Anthony wrote: Sorry, should be encodeURIComponent. What do you mean it doesn't find it? On Sunday, February 16, 2014 8:52:06 AM UTC-5, Avi A wrote: This almost works (no error): encodeURIComponent (without the d). But it doesn't find it On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote: ReferenceError: encodedURIComponent is not defined How do I define it? Do I have to import something? Thanks. On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote: great, thanks . On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: and what you expected ? :-P you built your function to post to an url like /base_url/ whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=)and its generally NOT safe doing what you're doing. User input in web applications needs to be either validated before or properly escaped.usually you'd want base_url?something= escaped_value that you can retrieve later with response.vars.something On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To
[web2py] Re: Special chars (like !) on ajax form.
Oops. alright, thanks a lot. On Sunday, February 16, 2014 4:58:06 PM UTC+2, Anthony wrote: You didn't update your controller code -- request.args(0) should now be request.vars.code. On Sunday, February 16, 2014 9:46:47 AM UTC-5, Avi A wrote: I mean that it displays the searching (the else part) and the query doesn't find it: org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: ... else: return 'searching..' if the password is just 123 it works. (and not 123!). On Sunday, February 16, 2014 4:35:55 PM UTC+2, Anthony wrote: Sorry, should be encodeURIComponent. What do you mean it doesn't find it? On Sunday, February 16, 2014 8:52:06 AM UTC-5, Avi A wrote: This almost works (no error): encodeURIComponent (without the d). But it doesn't find it On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote: ReferenceError: encodedURIComponent is not defined How do I define it? Do I have to import something? Thanks. On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote: great, thanks . On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: and what you expected ? :-P you built your function to post to an url like /base_url/ whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=)and its generally NOT safe doing what you're doing. User input in web applications needs to be either validated before or properly escaped.usually you'd want base_url?something= escaped_value that you can retrieve later with response.vars.something On Sunday, February 16, 2014 1:36:17 PM UTC+1, Avi A wrote: All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, type='string', default=uuid.uuid4(), writable=False), auth.signature, format='%(f_org_name)s', migrate=settings.migrate) db.define_table('t_orgs_archive', db.t_orgs, Field('current_record', 'reference t_orgs', readable=False, writable=False)) #controller: def org_form_load(): org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: db.t_org_members.f_org_rep.default = org_code_name[0].id db.t_org_members.f_org_member.default = auth.user.id label_org_name = 'Join ' + org_code_name[0].f_org_name + ' Organization' form = SQLFORM(db.t_org_members, onupdate=auth.archive, submit_button= label_org_name) if form.process().accepted: session.flash = 'Welcome to \'' + org_code_name[0].f_org_name + '\' Organization!' redirect(URL('default', 'api_key.html'), client_side=True) elif form.errors: response.flash = 'response errors' return dict(form=form, org_code_name=org_code_name) else: return 'searching.' #view div class=well well-sm pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) {{else:}} h4Organization api:/h4 {{=my_org_data[0].t_orgs.org_api_key}} {{pass}} div id = org_form_target/div script type=text/javascript function org_code_value(org_code) { var url ={{=URL('default', 'org_form_load.load')}}; $.web2py.component(url + '/' + org_code, 'org_form_target'); } /script On Sunday, February 16, 2014 2:17:31 PM UTC+2, Anthony wrote: What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, February 16, 2014 5:52:04 AM UTC-5, Avi A wrote: Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example ! in the password field , the form won't be accepted. Is there a solution for that? I would like to allow any char that won't break the javascript. db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', ... pType your organization code:/p input id=org_code_input onkeyup=org_code_value(this.value) $.web2py.component(url + '/' + org_code, 'org_form_target'); Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You
[web2py] Re: Custom login form - How to detect login failure?
Hey Anthony thanks for the reply. Yes I am using the auth.login() using a custom form. I am not using the flash message so if the user enters the wrong password the page just reloads without any indication of the login failure. Isn't there another way to find out if the login failed, so I can notify the user? Thank you! On Saturday, February 15, 2014 8:29:56 PM UTC+2, Anthony wrote: Depends on how you have customized the login. If you want to create a completely custom form and workflow, you can use auth.login_bare() to do the login -- it returns False if the login fails. If you want to use auth.login(), upon login failure, it automatically redirects back to the login page and displays a flash message. You can customize the flash message via auth.messages.invalid_login. Anthony On Saturday, February 15, 2014 11:32:58 AM UTC-5, desta wrote: Hello, I am building a custom *Login *form and I want to warn the user if his/her username/pass are wrong. How can I detect this? I tried through *form.errors* but its not there. I can understand that since its not error of the form but of authentication. Thank you. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Form format to match specific theme (bootsrtap)
Perfect! I will give it a try! Thanks! On Saturday, February 15, 2014 9:23:39 PM UTC+2, Anthony wrote: No, you do not have to modify the framework. You can put your custom function wherever you want (within your own code) -- you can put it in a module and import it, or just define in a model file. Anthony On Saturday, February 15, 2014 11:09:39 AM UTC-5, desta wrote: Thank you Anthony. If I create my custom function, where should it be located? In the /gluon/sqlhtml.py? Thanks again. On Saturday, February 15, 2014 3:37:00 PM UTC+2, Anthony wrote: SQLFORM takes a formstyle argument, which can be specified for the Auth forms via the auth.settings.formstyle setting. It can be set to bootstrap for Bootstrap 2 forms. However, it can also be set to a custom function -- so you can create your own for Bootstrap 3. For an example of such a function, see: https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L762https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fweb2py%2Fweb2py%2Fblob%2Fmaster%2Fgluon%2Fsqlhtml.py%23L762sa=Dsntz=1usg=AFQjCNFmO-V0xog7yBEAvWU3TXkWKokO2w . More generally, you can customize the Auth forms the same way you can customize any SQLFORM: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms Anthony On Saturday, February 15, 2014 5:09:55 AM UTC-5, desta wrote: Hello everyone, I am progressing well with my first application in web2py! At this point I need to apply the view theme. The chosen theme is based on the newest version of bootstrap. My question: Is there a way to change the format of the automatically generated forms to match that of the theme? My main worry is the authentication forms. How am I going to customize the login/register/forget_password etc, and still keep the security features embedded in those? Thank you. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Possible BUG using legacy tables
Here is what I have: I have a legacy db in mysql named cep, so I'd created two dbs in my application, one for the app and one for this legacy table: db = DAL('sqlite://storage.sqlite', pool_size=1, check_reserved=['all']) db_endereco = DAL('mysql://user:pass@localhost/cep') db_endereco.define_table('tend_estado', Field('id_estado', 'integer'), Field('estado', 'string', length=150), Field('uf', 'string', length=2), primarykey=['id_estado'], migrate=False) But when I go to APPADMIN and try to update a record: https://lh3.googleusercontent.com/-GKEZbzlUHn0/UwDaI9dP3uI/Eg4/KlEi40mEnAA/s1600/Untitled.png When I point the mouse to link, look in the bottom of the image that instead of update it brings function lambda at 0x Notice that for all other db. tables it works fine... but it wont work for all db_endereco. tables. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Custom login form - How to detect login failure?
I suppose you could do: if response.flash == auth.messages.invalid_login: Otherwise, you can create an auth.settings.login_onfail callback, which can then set a flag in the session indicating login has failed (or redirect somewhere). Anthony On Sunday, February 16, 2014 10:26:45 AM UTC-5, desta wrote: Hey Anthony thanks for the reply. Yes I am using the auth.login() using a custom form. I am not using the flash message so if the user enters the wrong password the page just reloads without any indication of the login failure. Isn't there another way to find out if the login failed, so I can notify the user? Thank you! On Saturday, February 15, 2014 8:29:56 PM UTC+2, Anthony wrote: Depends on how you have customized the login. If you want to create a completely custom form and workflow, you can use auth.login_bare() to do the login -- it returns False if the login fails. If you want to use auth.login(), upon login failure, it automatically redirects back to the login page and displays a flash message. You can customize the flash message via auth.messages.invalid_login. Anthony On Saturday, February 15, 2014 11:32:58 AM UTC-5, desta wrote: Hello, I am building a custom *Login *form and I want to warn the user if his/her username/pass are wrong. How can I detect this? I tried through *form.errors* but its not there. I can understand that since its not error of the form but of authentication. Thank you. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to fix DAL, datetime error
Thanks Niphlod. Deleting the database fixed it. I had encountered a few similar errors in the past where deleting the database fixed it. However, this is the first one I've come across where the app would still partially work and not fail immediately at startup. Sounds like SQLite may not even be a good choice for development considering the bug, chasing fantom errors due to how it handles altered tables/columns. Is there a dbms you suggest that works most nicely with web2py for small applications? From my very minor experience and only reading on the web, I see few negatives with Postgres. Thanks again. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Custom login form - How to detect login failure?
Or you could automatically check for auth.user_id right after the validation. Em domingo, 16 de fevereiro de 2014 12h39min40s UTC-3, Anthony escreveu: I suppose you could do: if response.flash == auth.messages.invalid_login: Otherwise, you can create an auth.settings.login_onfail callback, which can then set a flag in the session indicating login has failed (or redirect somewhere). Anthony On Sunday, February 16, 2014 10:26:45 AM UTC-5, desta wrote: Hey Anthony thanks for the reply. Yes I am using the auth.login() using a custom form. I am not using the flash message so if the user enters the wrong password the page just reloads without any indication of the login failure. Isn't there another way to find out if the login failed, so I can notify the user? Thank you! On Saturday, February 15, 2014 8:29:56 PM UTC+2, Anthony wrote: Depends on how you have customized the login. If you want to create a completely custom form and workflow, you can use auth.login_bare() to do the login -- it returns False if the login fails. If you want to use auth.login(), upon login failure, it automatically redirects back to the login page and displays a flash message. You can customize the flash message via auth.messages.invalid_login. Anthony On Saturday, February 15, 2014 11:32:58 AM UTC-5, desta wrote: Hello, I am building a custom *Login *form and I want to warn the user if his/her username/pass are wrong. How can I detect this? I tried through *form.errors* but its not there. I can understand that since its not error of the form but of authentication. Thank you. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Custom login form - How to detect login failure?
On Sunday, February 16, 2014 11:07:21 AM UTC-5, André Kablu wrote: Or you could automatically check for auth.user_id right after the validation. The problem is the auth.login() function does a redirect after failed login, so there's no opportunity to do anything after the auth.login() function completes. You would have to use the auth.settings.login_onfail callback. Also, note that checking for auth.user_id after the redirect doesn't help because at that point, there is no way to distinguish between a failed login and a normal arrival at the login page. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] autodelete failure!
I had the same problem of uploading image in SQLFORM.factory as in https://groups.google.com/forum/#!searchin/web2py/manual$20upload$20sqlform/web2py/Cw5ggpU6CIc/kS6fiRK8l7wJ mdipierro showed number of ways to solve it and his last solution worked for me. But now if I delete the record from the database, the image file on the file system does not get deleted. am I missing something? I am using version 2.8.2 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Fixed issue 1422 introduced a bug in generic rss views?
I'm having the same issue with rss in my InstantPress powered blog. I think it has the same roots. I also replaced the saxutils.py file with the patched one and nothing changed. On Tuesday, June 4, 2013 1:53:03 PM UTC+7, Loïc wrote: Hello all, Am I the only one having issues with generic RSS views? Is there any workaround for my problem? Thank you Le dimanche 2 juin 2013 14:16:25 UTC+2, Loïc a écrit : Well, I replaced python27/lib/xml/sax/*saxutils.py *with the patched file (see attached) But I still have the same error : Ticket ID 127.0.0.1.2013-06-02.14-13-25.c9feb7ca-4163-463e-ad44-185a7141dc9d type 'exceptions.UnicodeDecodeError' 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)Versionweb2py™Version 2.4.7-stable+timestamp.2013.05.24.17.48.47PythonPython 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. Traceback (most recent call last): File D:\Google Drive\loic\web2py\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File D:\Google Drive\loic\web2py\web2py\applications\dommartin25\views\generic.rss, line 10, in module from gluon.serializers import rss}}{{=XML(rss(response._vars))}} File D:\Google Drive\loic\web2py\web2py\gluon\serializers.py, line 174, in rss ) for entry in feed.get('entries', [])]) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128) Any idea? Thank you Le vendredi 31 mai 2013 12:30:34 UTC+2, Loïc a écrit : Sorry but I installed latest python version on my laptop (python 2.7.5 on Win7 x64) and it still doesn't work : type 'exceptions.UnicodeDecodeError' 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128) Versionweb2py™Version 2.4.7-stable+timestamp.2013.05.24.17.48.47PythonPython 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. Traceback (most recent call last): File D:\Google Drive\loic\web2py\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File D:\Google Drive\loic\web2py\web2py\applications\dommartin25\views\generic.rss, line 10, in module from gluon.serializers import rss}}{{=XML(rss(response._vars))}} File D:\Google Drive\loic\web2py\web2py\gluon\serializers.py, line 174, in rss ) for entry in feed.get('entries', [])]) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128) I'm not a python-master like you, Niphlod and Sebastian, but would it be possible to make something like below in order not to break backward compatibility when one updates Web2py 2.4.5 to 2.4.7? *in seriaizers.py (this code doesn't work, it is just to explain my idea...)* *def rss(feed):if not 'entries' in feed and 'items' in feed: feed['entries'] = feed['items']now = datetime.datetime.now()try: rss = rss2.RSS2(title=str(feed.get('title', '(notitle)').encode('utf-8', 'replace')), link=str(feed.get('link', None).encode('utf-8', 'replace')), description=str(feed.get('description', '').encode('utf-8', 'replace')),lastBuildDate=feed.get('created_on', now),items=[rss2.RSSItem( title=str(entry.get('title', '(notitle)').encode('utf-8', 'replace')), link=str(entry.get('link', None).encode('utf-8', 'replace')), description=str(entry.get('description', '').encode('utf-8', 'replace')), pubDate=entry.get('created_on', now) ) for entry in feed.get('entries', [])])except Exception: #if an exception is raised, we use the former methon which works finerss = rss2.RSS2(title=str(feed.get('title', '(notitle)')), link=str(feed.get('link', None)), description=str(feed.get('description', '')), lastBuildDate=feed.get('created_on', now), items=[rss2.RSSItem( title=str(entry.get('title', '(notitle)')), link=str(entry.get('link', None)), description=str(entry.get('description', '')), pubDate=entry.get('created_on', now) ) for entry in feed.get('entries', [])])return rss.to_xml(encoding='utf-8')* Thank you Le jeudi 30 mai 2013 23:09:53 UTC+2, Sebastian Ortiz Vasquez a écrit : Is not mandatory, is enough appling the patch described above to the sax_parser. On Thu, May 30, 2013 at 4:08 PM, Loïc ESPERN lo...@espern.net wrote: I'm currently using python 2.7.3 Should I update to the latest 2.7.5 to get this
[web2py] intermittent edit
I downloaded the latest web2py and I get intermittent ability to edit files. I am using a Raspberry Pi model B. I tried editing today and no can do. I can view the file but can not edit it. I tried Firefox, Google Chrome and IE but am not able to edit. Seems if I reboot my RPI and reconnect to my HTTPS, I will get one edit and the second time I try to edit, I am no longer able to. Thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: CAS provider and registration
I am open to change this. Do you want to attempt a patch to address some of the issues? Massimo On Sunday, 16 February 2014 05:39:31 UTC-6, Alexei Vinidiktov wrote: The first issue is that the client app that uses a cas provider only provides one option: to log in - in the top navigation bar. I think some users would be at a loss as to how to register since there is no explicit link. The second and third issues are with the cas provider login page. After the user follows the login link in the cas client app what they see in the cas provider app is the navigation bar that has a drop down menu that says Login. And they see two fields for entering their email and password and a single login button. So the second issue is that coming from the cas client page they can wrongly assume that the login drop down menu in the navigation bar of the cas provider app can only log them in (not register). A work around would be to use the default mode for the auth links in the nav bar which will show all the links (login, registration, lost password) on the nav bar (instead of a drop down). The third issue is with the single login button on the cas provider app. For consistency with the normal (not cas) login pages I think that instead of showing only one login button it would be more user-friendly if the login page in the cas provider displayed the same buttons underneath the email and password boxes - the login, register and lost password button - as the normal login page does. The fourth issue is that if the user is not registered and thus goes from the client app to the cas login page and from there to the cas registration page, after a successful registration they are not redirected to the cas client app. I think many users would not know how to return to the cas client app after the registration. On Sun, Feb 16, 2014 at 2:34 PM, Tim Richardson t...@growthpath.com.aujavascript: wrote: As long as you allow users to register in your auth settings (and by default they can), there is a register option on the login menu of the cas screen. This is based on trunk. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Alexei Vinidiktov -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Menus and Selected Tab
In the latest version of web2py, this solution no longer works. There's no web2py-menu-active class. Is it now standard policy for web2py apps not to have menu selections highlighted? Thanks. On Monday, 17 October 2011 15:00:38 UTC-4, Paolo Caruccio wrote: If you're using respone.menu to build your menu and in line with http://www.web2py.com/book/default/search?search=response.menu you could replace the second item (the boolean value)in the tuple with the check (request.function=='index') where index is your active page. In this way web2py automatically add to li tag (your menu tab) the class=web2py-menu-active. So in .css file you can customize it. For example (I'm using default w2p application welcome): ### in menu.py (welcome app models folder) ### response.menu = [ (T('Home'), False, URL('default','index'), []) ] becomes response.menu = [ (T('Home'), (request.function=='index'), URL('default','index'), []) ] ### in layout.html (welcome app views folder ### change this {{=MENU(response.menu,_class='sf-menu')}} to {{=MENU(response.menu,_class='sf-menu',li_active=tab_highlighted)}} li_active allows to change default class web2py-menu-active to your preference. In the above example tab_highlighted. ### in base.css (welcome app static/css subfolder) append the css rule .web2py-menu-active a, .tab_highlighted a{color:red} Ciao. Paolo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Is there a way to use parameters on --run (-R) ?
Thanks!!! On Sat, Feb 15, 2014 at 1:10 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: python web2py.py -S welcome -M -R tito.py -A param1 param2 On Friday, 14 February 2014 16:35:15 UTC-6, Tito Garrido wrote: Hi Folks, Just a simple test... an external script: $: cat tito.py import sys print sys.argv Then running with web2py: $ python web2py.py -S welcome -M -R tito.py param1 param2 web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2014 Version 2.8.2-stable+timestamp.2013.11.28.13.54.07 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib) ['tito.py'] *How could I grab the parameters that I need for my script from shell?* Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Another PEP8 sore
Folks, take a look at this piece of code: topics = db((db.topic.id == topic_id) (db.topic.active == True)).select() PEP8 is breaknig with the following error: default.py:xxx:yy: E712 comparison to True should be 'if cond is True:' or 'if cond:' And of course changing (db.topic.active == True) To (db.topic.active) Or (db.topic.active is True) Passes the PEP8 test, but it does not yield any results. Any suggestions on how to handle this? - I know PEP8 are just 'recommendations' but I wonder if there is another way to handle this.. Thanks, Julio -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Apply class to MARKMIN helper?
So with other helpers I can do things like P(db.table.field, _class=text-centered) to center the text in a paragraph tag generated by the P helper. Is there any way to do the same with the MARKMIN helper? I have {{=MARKMIN(post.caption)}} set for a photo blog app so I can easily style my photo captions with Markmin. However I'd like the text centered. Since the MARKMIN helper always wraps text in the p I can't center the text by wrapping the helper in the span or div. The MARKMIN helper does not accept classes. Is there a way to do this without creating new CSS rules? My current workaround is to wrap it in the div with the class markmin and add a CSS rule to P tags within the div. If there's no better way I suggest changing the MARKMIN helper to accept classes then applying to classes to all of the p tags the MARKMIN helper generates. It would be very useful for clean style code. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] View does not display datetime in format chosen in database.
I have the following in my model: Field('date', 'date', default=datetime.date.today(), requires = IS_DATE( format=('%B %-d, %Y')), writable=False,readable=False), ...and in the appadmin database entry form the date displays in the format I've chosen. However when db.mytable.date is called in a view it displays in the default -MM-DD format. According to all the search results I've found setting the requires=IS_DATE format should fix this. How do I get the view to render the date in the format I want? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Another PEP8 sore
PEP8 has limitations. field is True would never work because the is operator cannot be overloaded. Only the == can be overloaded. Massimo On Sunday, 16 February 2014 12:41:48 UTC-6, Julio F. Schwarzbeck wrote: Folks, take a look at this piece of code: topics = db((db.topic.id == topic_id) (db.topic.active == True)).select() PEP8 is breaknig with the following error: default.py:xxx:yy: E712 comparison to True should be 'if cond is True:' or 'if cond:' And of course changing (db.topic.active == True) To (db.topic.active) Or (db.topic.active is True) Passes the PEP8 test, but it does not yield any results. Any suggestions on how to handle this? - I know PEP8 are just 'recommendations' but I wonder if there is another way to handle this.. Thanks, Julio -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Question on linking fields
Hi everyone... Linked tables like... db.define_table('calls', Field('business', 'string'), ... and db.define_table('leads', Field('business', 'reference calls'), ... with controller containing def calls(): form = SQLFORM(db.calls) if form.process().accepted: redirect(URL('leads')) and form {{extend 'layout.html'}} {{=form}} create a drop down linking list for the Business field... How can I make this default to the record that has just been created in 'calls' instead? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] postgres beginner questions: passwords, peer authentication, dev/production
postgres has peer authentication. If I have mapped OS user www-data to a postgres role, and if apache runs as www-data, can I use peer authentication in web2py and therefore not code a password in? It seems that the connection string is parsed for user and password. The main reason I want to avoid a password is that it having a different password in development and production becomes a nuisance. However, everyone must have this inconvenience; what's the solution that I'm missing? (I use git between development and production) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Web2py instead of MS Access?
Anthony that is really good, very impressive and just what I want! From memory that so far actually seems to be both simpler and better than what MS Access would offer. A lot of people and companies could make good use of web2py as a database, Especially small businesses and charities etc. I need to do a bit more delving and get myself up to speed hopefully. However those precise instructions are a base for progress, thanks to both yourself and Neo for your time. I will leave this open for a few more days in case anybody else has something to add. Many thanks. Jimmy. On Saturday, 15 February 2014 14:35:49 UTC, jimbo wrote: Hi I am thinking of using web2py for a small database instead of MS Access. It is for a charity and would have only several hundred records of employees and a table for clients. It would run on a local network with probably only two computers using it. The usual name, address , tel no. and some certificate and photo. It would avoid licence fees for a start and I think easier to use via a browser I know a little about Access but very basic. Are there any simple examples of where I could start, or some web2py appliance available? If any you can help or have something I can look at I would be very grateful. It's as much a learing thing for myself as I know virtually nothing aobut DB's. Thanks, Jim -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: is there a way to detect x-frames ?
found something that seems to work (after some modifications) #http://chase-seibert.github.io/blog/2011/01/21/youtube-detecting-x-frame-optionsframebreaking-in-python.htm def Is_Framing_Allowed ( URL ) : import urllib2 req = urllib2.Request ( URL ) ##req.add_header ( Referer, http://example.com;) # you should put your real URL here try : opener = urllib2.urlopen ( req ) except : return False # returns True if ANY x-frame-options header is present # the only options at present are DENY and SAMEORIGIN, either of which means you can't frame return not x-frame-options in opener.headers.dict On 16-02-14 1:26, Stef Mientki wrote: hello, I want to show external sites in an IFRAME (including the link to the orginal site), so I can add comment to the external website, but some sites won't show in an IFRAME. This seems to e due to X-Frame options. Is there a way to detect if there are any x-frame-options, so I can make a choose to display the site in an IFrame or as a direct link to the externa website? thanks, Stef -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] how to get globals like request available in my own modules ?
hello, how to get globals like request available in my own modules ? thanks, Stef -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] pass values in state parameter oauth
inside the user() action in controllers/default.py you can add: if request.vars.state: auth_provider = cgi.parse_qs(request.vars.state)['auth_provider'][0] then you can do what you need with auth_provider 2014-02-16 12:13 GMT+01:00 ssuresh sureshsarka...@gmail.com: I am using google oauth login as explained here https://groups.google.com/forum/#!msg/web2py/fjpbFxRAGJM/pxvoBJKk2UkJ.. I am trying to use the state parameter to pass some additional values to google. As I understand we should get the values back in the response from google. My authentication is working fine and I am able to retrieve first name last name etc.. But I am not able toget the state values... Any ideas? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: how to get globals like request available in my own modules ?
http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules On Sunday, February 16, 2014 4:55:06 PM UTC-5, aapaap wrote: hello, how to get globals like request available in my own modules ? thanks, Stef -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: how to get globals like request available in my own modules ?
I assume that if you will use modules they'll probably be implemented in some kind of class, I'd personally do something similar to this.. # mymodule.py class ModuleHelper(object): Sample Helper for common methods. def __init__(self, environment): self.request = environment['request'] self.response = environment['response'] self.session = environment['session'] self.cache = environment['cache'] self.db = environment['db'] self.auth = environment['auth'] def method(self): self.request.get('variable', ) ... And when instantiating the module say from a model: # mymodel.py from mymodule import ModuleHelper ... And Later in the same mymodel.py ... # Make the module class/methods available: my_module_helper = ModuleHelper(globals()) Now you can use my_module_helper.my_method(params) from within any view or controller.. Hope it helps. Julio On 02/16/2014 01:55 PM, Stef Mientki wrote: hello, how to get globals like request available in my own modules ? thanks, Stef -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: how to get globals like request available in my own modules ?
Note, instead of this method, you can now use gluon.current. Anthony On Sunday, February 16, 2014 6:32:13 PM UTC-5, Julio F. Schwarzbeck wrote: I assume that if you will use modules they'll probably be implemented in some kind of class, I'd personally do something similar to this.. # mymodule.py class ModuleHelper(object): Sample Helper for common methods. def __init__(self, environment): self.request = environment['request'] self.response = environment['response'] self.session = environment['session'] self.cache = environment['cache'] self.db = environment['db'] self.auth = environment['auth'] def method(self): self.request.get('variable', ) ... And when instantiating the module say from a model: # mymodel.py from mymodule import ModuleHelper ... And Later in the same mymodel.py ... # Make the module class/methods available: my_module_helper = ModuleHelper(globals()) Now you can use my_module_helper.my_method(params) from within any view or controller.. Hope it helps. Julio On 02/16/2014 01:55 PM, Stef Mientki wrote: hello, how to get globals like request available in my own modules ? thanks, Stef -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: postgres beginner questions: passwords, peer authentication, dev/production
I think I will just create postgre roles per app and worry less about this. On Monday, 17 February 2014 08:20:05 UTC+11, Tim Richardson wrote: postgres has peer authentication. If I have mapped OS user www-data to a postgres role, and if apache runs as www-data, can I use peer authentication in web2py and therefore not code a password in? It seems that the connection string is parsed for user and password. The main reason I want to avoid a password is that it having a different password in development and production becomes a nuisance. However, everyone must have this inconvenience; what's the solution that I'm missing? (I use git between development and production) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Proper jQuery syntax in a component.load to refer an element in the containing HTML file?
I have an index.html page that loads two elements: 1) A select list, id='account_select' 2) A component (open_positions.load) In the component (open_positions.load), I have a script that needs to get the value the select list (id='account_select') in the parent document. The following code does not work: $('#account_select).value Nor does this work: $(#account_select, parent.document).value What is the proper jQuery syntax to refer to the select list in the parent html file from a script within the component.load file? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: REF: Join query help!
Hi, To makes things easier I have resolved to use db.executesql() it gives a bit more flexibility were dal object model maybe a bit complex. Thanx for your help thus far! On 14 Feb 2014 21:10, Teddy Nyambe software@gmail.com wrote: Apologies if I was not clear, when you do a cross join as in the example you get Rows now, and your code is as I meant it was just a typo, my need is to represent the record set into json object...it works well if there is no join, but when another table comes in the picture the way to access fields changes db.table.field So I want a rows to be represented as ['fieldname', 'field value], ['fieldname', 'field value], ['fieldname', 'field value], etc It's easy with a single table but when your record set has fields from another table it becomes a problem...this is my working iteration with single table but joint does not apply: def get_json(rs): json = [ for row in rd: json += { for key, value in (row.as_dict()).values: json += ',key, ':', value,' json += }, json += ] On 14 Feb 2014 15:11, Leonel Câmara leonelcam...@gmail.com wrote: I'm not sure I'm understanding exactly what you're trying to do. You say you want to display the value of the foreign key (which would be an integer) but in your code you seem to be only interested in the names. So this may or may not be what you want. I've found a bug here rs = db(db.owner.id==db.dog.owner).select(db.owner.name, db.owner.name) This should be: rs = db(db.owner.id==db.dog.owner).select(db.owner.name, db.dog.namehttp://db.owner.name/ ) Then you can do: for r in rs: print r.owner.name + ' : ' + r.dog.name -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: logout error
Sorry Massimo, I commented both the requires_login() and requires_permission() for both dashboard() and my index() functions, still the error is same. 2014-02-17 06:12:42,411 - ERROR - app - Traceback (most recent call last): File /srv/trustvouch-fe/applications/app/controllers/default.py, line 25, in login form = auth.login() File /srv/trustvouch-fe/gluon/tools.py, line 2393, in login redirect(next, client_side=settings.client_side) File /srv/trustvouch-fe/gluon/http.py, line 147, in redirect Location=loc) HTTP: 303 SEE OTHER got no idea on this. On Sunday, 16 February 2014 13:35:20 UTC+5:30, Massimo Di Pierro wrote: Sorry I mean here: @auth.requires_login() @auth.requires_permission(request.function) def dashboard(): you should NOT have both. Perhaps this was causing the problem? On Saturday, 15 February 2014 09:15:18 UTC-6, ajith c t wrote: Hi Massimo, Thanks for the reply, but sorry to say this, but I didn't understand what you meant there, which function should have both. I wanted every user to have login and logout functions, thats why I didn't add auth.permission for them. And can you explain why it is giving 303 error. Is it something with the redirect(next). On Thursday, 13 February 2014 18:16:27 UTC+5:30, ajith c t wrote: Hi , I am using web2py 2.5.1-stable+timestamp.2013.06.06.15.39.19 in my production environment. I know it is old but thinking about the mysql and other folders and files structure changes I am little hesitant to update it. My problem is this. My logout function doesn't work properly. # Login function def login(): try: logger.debug(login page) form = auth.login() return dict(form = form) except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) @auth.requires_login() def index(): try: if auth.has_membership('root'): logger.debug(auth.user.first_name + : logged in) redirect(URL('default', 'usrMgr')) else: logger.debug(auth.user.first_name +: logged in) redirect(URL('dashboard')) except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) @auth.requires_login() @auth.requires_permission(request.function) def dashboard(): try: logger.info(dashboard) ###Some Code### except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) def logout(): try: logger.debug(logout) auth.logout(next=URL(r=request, c='default', f='login')) return dict() except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) The behavior is different in different browsers. In Chrome when I select logout from the dashboard page, it remains in the same page. When I select the developer tools and check the network the urls are logout, login, dashboard in order and its loaded from cache. But there is no problem in firefox. My problem is the logut function doesnt redirect to login page. When I clear the browser cache or delete all the sessions in the sessions folder, it works neatly. But when the session file or the cache gets filled up, everything goes wrong. Let me know if I wasn't specific, so I can clear this problem. Thanks and Regards, Ajith -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Insert on related tables by code
Goodmorning, i:m trying to fill a table record by code. All the basic test went good,but now i'm trying to fill a table that has a field wich is a foreign key of another. luca field ('name', db.person) whrn i try to fill i catch an error . . in which way i can compose my instruction for do it? thank you in advance x you patience luca -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: logout error
Hi Massimo, there is one more thing, it seems that the redirect problem is not only with my login function. Every function where I use a redirect call from my controller results in a error page with a log as 303 error. File /srv/trustvouch-fe/applications/app/controllers/default.py, line 480, in mrtusrMgr form = crud.update(db.tv_auth_users, request.args(1), next=URL('mrtusrMgr')) File /srv/trustvouch-fe/gluon/tools.py, line 3906, in update redirect(next) File /srv/trustvouch-fe/gluon/http.py, line 147, in redirect Location=loc) HTTP: 303 SEE OTHER File /srv/trustvouch-fe/applications/app/controllers/reportmgr.py, line 85, in options redirect(URL('reportmgr', 'list')) File /srv/trustvouch-fe/gluon/http.py, line 147, in redirect Location=loc) HTTP: 303 SEE OTHER On Monday, 17 February 2014 11:57:29 UTC+5:30, ajith c t wrote: Sorry Massimo, I commented both the requires_login() and requires_permission() for both dashboard() and my index() functions, still the error is same. 2014-02-17 06:12:42,411 - ERROR - app - Traceback (most recent call last): File /srv/trustvouch-fe/applications/app/controllers/default.py, line 25, in login form = auth.login() File /srv/trustvouch-fe/gluon/tools.py, line 2393, in login redirect(next, client_side=settings.client_side) File /srv/trustvouch-fe/gluon/http.py, line 147, in redirect Location=loc) HTTP: 303 SEE OTHER got no idea on this. On Sunday, 16 February 2014 13:35:20 UTC+5:30, Massimo Di Pierro wrote: Sorry I mean here: @auth.requires_login() @auth.requires_permission(request.function) def dashboard(): you should NOT have both. Perhaps this was causing the problem? On Saturday, 15 February 2014 09:15:18 UTC-6, ajith c t wrote: Hi Massimo, Thanks for the reply, but sorry to say this, but I didn't understand what you meant there, which function should have both. I wanted every user to have login and logout functions, thats why I didn't add auth.permission for them. And can you explain why it is giving 303 error. Is it something with the redirect(next). On Thursday, 13 February 2014 18:16:27 UTC+5:30, ajith c t wrote: Hi , I am using web2py 2.5.1-stable+timestamp.2013.06.06.15.39.19 in my production environment. I know it is old but thinking about the mysql and other folders and files structure changes I am little hesitant to update it. My problem is this. My logout function doesn't work properly. # Login function def login(): try: logger.debug(login page) form = auth.login() return dict(form = form) except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) @auth.requires_login() def index(): try: if auth.has_membership('root'): logger.debug(auth.user.first_name + : logged in) redirect(URL('default', 'usrMgr')) else: logger.debug(auth.user.first_name +: logged in) redirect(URL('dashboard')) except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) @auth.requires_login() @auth.requires_permission(request.function) def dashboard(): try: logger.info(dashboard) ###Some Code### except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) def logout(): try: logger.debug(logout) auth.logout(next=URL(r=request, c='default', f='login')) return dict() except Exception,e: logger.error(traceback.format_exc()) redirect(URL(errorpage)) The behavior is different in different browsers. In Chrome when I select logout from the dashboard page, it remains in the same page. When I select the developer tools and check the network the urls are logout, login, dashboard in order and its loaded from cache. But there is no problem in firefox. My problem is the logut function doesnt redirect to login page. When I clear the browser cache or delete all the sessions in the sessions folder, it works neatly. But when the session file or the cache gets filled up, everything goes wrong. Let me know if I wasn't specific, so I can clear this problem. Thanks and Regards, Ajith -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Web2py instead of MS Access?
Anthony's example is great. Anyway, I would recommend replacing this: def index(): return dict(grid=SQLFORM.grid(db.person, user_signature=False)) with this: @auth.requires_login() def index(): return dict(grid=SQLFORM.smartgrid(db.person)) user_signature=False will expose all data to users of the system without requiring a registration/password. Apart for security implications, that will prevent versioning and auditing database changes. On Sunday, 16 February 2014 15:24:55 UTC-6, jimbo wrote: Anthony that is really good, very impressive and just what I want! From memory that so far actually seems to be both simpler and better than what MS Access would offer. A lot of people and companies could make good use of web2py as a database, Especially small businesses and charities etc. I need to do a bit more delving and get myself up to speed hopefully. However those precise instructions are a base for progress, thanks to both yourself and Neo for your time. I will leave this open for a few more days in case anybody else has something to add. Many thanks. Jimmy. On Saturday, 15 February 2014 14:35:49 UTC, jimbo wrote: Hi I am thinking of using web2py for a small database instead of MS Access. It is for a charity and would have only several hundred records of employees and a table for clients. It would run on a local network with probably only two computers using it. The usual name, address , tel no. and some certificate and photo. It would avoid licence fees for a start and I think easier to use via a browser I know a little about Access but very basic. Are there any simple examples of where I could start, or some web2py appliance available? If any you can help or have something I can look at I would be very grateful. It's as much a learing thing for myself as I know virtually nothing aobut DB's. Thanks, Jim -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] expanding files
is there a function like expand_one that allows you to display (.txt .docx .pptx .pdf) files? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: expanding files
if I can use expand_one to do so, I don't know how... please help On Monday, 17 February 2014 07:39:42 UTC, sasogeek wrote: is there a function like expand_one that allows you to display (.txt .docx .pptx .pdf) files? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: expanding files
if I can use expand_one to do so, I don't know how... please help On Monday, 17 February 2014 07:39:42 UTC, sasogeek wrote: is there a function like expand_one that allows you to display (.txt .docx .pptx .pdf) files? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.