[web2py] Is there any way to undo impersonation?

2017-04-09 Thread Alfonso Serra
I have implemented an admin impersonating users successfully, but was wondering if theres any way to go back to the admin while impersonating without having to manually logout - loging. Thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py

[web2py] Re: Auth change password confirmation

2017-04-09 Thread Alfonso Serra
Thanks Anthony, but thats the matter, redirection is not optional. It will happen regardless. I would like not to redirect to make use of form.errors, form.accepted to style the view. Other issue is that change password and profile shares the same view, so there are multiple redirections going o

[web2py] Re: auth.register is only posible when theres not a user logged in.

2017-04-09 Thread Alfonso Serra
auth.register_bare sounds like it is what im looking for. Il give it a try, Many thanks 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 rece

[web2py] dynamic menu

2017-04-09 Thread Marlysson Silva
You can use the tables in database to handle the links and your permissions and in tour menu.py make the query search this links -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/li

[web2py] Re: auth.register is only posible when theres not a user logged in.

2017-04-09 Thread Anthony
You have four options: - Use auth.get_or_create_user() - Use auth.register_bare() (which calls get_or_create_user) - Just create a SQLFORM based on the db.auth_user table and insert a record. - Use /appadmin/manage/auth, as described here: https://groups.google.com/d/msg/web2py

[web2py] Re: Auth change password confirmation

2017-04-09 Thread Anthony
You are probably better off using the onaccept callback, which could do its own redirect and/or set a session flag. Anthony On Sunday, April 9, 2017 at 5:22:02 PM UTC-4, Alfonso Serra wrote: > > Ok its sorted but i had to change tools.py to remove the redirection, line > 3978 like: > >

[web2py] email and ldap login

2017-04-09 Thread 黄祥
trying to learn email and ldap login from the book *e.g.* *models/db.py* auth.define_tables(username = True, signature = True) # smtp server login #auth.settings.actions_disabled = ['register', 'change_password', 'request_reset_password'] from gluon.contrib.login_methods.email_auth import email_a

[web2py] Re: use memcache

2017-04-09 Thread 黄祥
after adding the code, still got the same error : AttributeError: 'MemcacheClientObj' object has no attribute 'initialize' *e.g.* class MemcacheClientObj(Client): def initialize(self): pass btw the problem is fixed when not assigned it into cache.ram and cache.disk *e.g.* #cache.ram =

[web2py] auth.register is only posible when theres not a user logged in.

2017-04-09 Thread Alfonso Serra
form = auth.register() doesnt have in mind private sites like business dashboards where an admin would be able to register new users. Its only posible to register users when theres not a user logged in. tools.py line 3267: def register(self, next=DEFAULT, onva

[web2py] Re: Auth change password confirmation

2017-04-09 Thread Alfonso Serra
Ok its sorted but i had to change tools.py to remove the redirection, line 3978 like: if form.accepts(request, session, formname='change_password', onvalidation=onvalidation, hideerror=self.settings.hideerror):

[web2py] Dropdown lists cascade in Crud form

2017-04-09 Thread Winter Kryz
Hello everybody, I have a table called Person Db.py db.define_table('Person', Field('last name', 'string',label='Last Name'), Field('First name', 'string',label='First Name'), Field('City','reference City',label='City', requires = IS_IN_DB(db,db.C

[web2py] Re: Auth change password confirmation

2017-04-09 Thread Alfonso Serra
It is always False. Reading the auth.change_password() code. Theres always a redirection. The only method to know about the password change is session.flash. Now i cant get session.flash because i have multiple auth forms in the same view and there may be multiple redirections that sets sessio

[web2py] Re: Auth change password confirmation

2017-04-09 Thread Anthony
What happens if you do: if form_pass.accepted: Anthony On Sunday, April 9, 2017 at 1:14:11 PM UTC-4, Alfonso Serra wrote: > > I cant check if the auth form to change a password is accepted. I have > been debugging a post and post_vars and form.vars are empty. I dont know > whats going, the

[web2py] Auth change password confirmation

2017-04-09 Thread Alfonso Serra
I cant check if the auth form to change a password is accepted. I have been debugging a post and post_vars and form.vars are empty. I dont know whats going, the password is changed succesfully but i cant display a message since i dont know how to check the form's state. I have the profile and c

[web2py] Re: use memcache

2017-04-09 Thread Paolo Valleri
Regarding the first problem you posted. Try adding: def initialize(self): pass in https://github.com/web2py/web2py/blob/master/gluon/contrib/memcache/__init__.py#L22 Let us know. Paolo On Friday, April 7, 2017 at 12:29:14 AM UTC+2, 黄祥 wrote: > > Tried to learn about memcache, creat

[web2py] Re: how to change the default auth.navbar controller

2017-04-09 Thread Rudy
Sorry Anthony, i just checked, your suggestion works when i have accounting and ticketing systems sharing the same auth's tables, basically it just uses the 'user' action under accounting controller to do all the authentication. Appreciate if you can provide pointer for more info about Auth() a

[web2py] Re: how to change the default auth.navbar controller

2017-04-09 Thread Rudy
Hi Anthony, Thanks again, it works. Now it leads to another question - my application has accounting system and ticketing system sharing the same auth's tables. The 2 systems are in different controllers namely accounting & ticketing. All my accounting view htmls extend layout_accounting.html,

[web2py] checklist for matplotlib

2017-04-09 Thread Ron Chatterjee
https://github.com/juliangaal/python-cheat-sheet/blob/master/Matplotlib/Matplotlib.md -- 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 me

[web2py] Re: how to change the default auth.navbar controller

2017-04-09 Thread Anthony
auth = Auth(..., controller='accounting', function='user') Anthony On Sunday, April 9, 2017 at 11:13:33 AM UTC-4, Rudy wrote: > > Hi there, > > I have created an accounting application, say the landing page is > http://localhost:8000/tests/accounting/index. I need to change the link > under "LO

[web2py] Re: lack of documentation

2017-04-09 Thread Anthony
On Sunday, April 9, 2017 at 10:35:04 AM UTC-4, Andrea Fae' wrote: > > Web2py is wonderful, but it has a big challenge. No documentation. Or at > least no complete documentation. It's all based on the book > The book *is* the documentation, and is fairly comprehensive. What exactly do you conside

[web2py] how to change the default auth.navbar controller

2017-04-09 Thread Rudy
Hi there, I have created an accounting application, say the landing page is http://localhost:8000/tests/accounting/index. I need to change the link under "LOG IN" dropdown menu on top right corner to http://./tests/accounting/user/login instead of using http://./tests/default/user/logi

[web2py] lack of documentation

2017-04-09 Thread Andrea Fae'
Web2py is wonderful, but it has a big challenge. No documentation. Or at least no complete documentation. It's all based on the book and some site that can give you suggestions...it's too less. Is there any person tha can tell me a complete reference of the language (don't tell me the api, I'm n

[web2py] dynamic menu

2017-04-09 Thread Andrea Fae'
I'm writing an application for managing sites and people in this sites with different roles. In my menu.py I have, for example this code if auth.has_membership('total-manager') | auth.has_membership('pordenone-manager'): response.menu.append( ('Sede Pordenone', False, None, [

[web2py] Re: Create Register on Restapi

2017-04-09 Thread PK
On Thursday, April 6, 2017 at 1:43:46 AM UTC+6:30, Massimo Di Pierro wrote: > > there is a pending PR that will expose an API. One approach is to do it > manually as follows: > > 1) App POSTs username/password which uses web2py auth.login_bare() > 2) store the user id (and only the user id)