[web2py] Re: username and email login (auth)

2013-06-02 Thread Gustavo Souza
Worked for me the following code: if 'login' in request.args: auth.settings.login_userfield = 'username' if request.vars.username and not IS_EMAIL()(request.vars.username)[1]: auth.settings.login_userfield = 'email' request.vars.email =

[web2py] Re: dynamically generate table fields

2013-06-02 Thread Alan Etkin
# So, I want to dynamically add this fields gravity_x, gravity_y, magnetism_x, magnetism_y, to the table You can create Field objects and place them inside a list and then call .define_tables unpacking it. # fixed values fields = [Field(grapes), Field(pineapples)] # build fieds from a

Re: [web2py] web2py Safety discussion

2013-06-02 Thread Kevin Bethke
Having this file is awesome I will write a few lines of code to add this to my security report. just one question: I tested a failed login myself because my file was fortunatly empty. The file format looks like this: ip 1 1370164406 I asume the one is number of attemps and the long number is a

[web2py] Re: app about page

2013-06-02 Thread BlueShadow
https://lh6.googleusercontent.com/-oDE7O7Yvqgk/UasTv8GH5TI/AAk/lB1eTk0eIcw/s1600/project+progress.gif I stumbled apon the about page and this graph so I searched the forums and found this post. seeing the number of lines written is pretty interesting but I can't figure this graph out.

Re: [web2py] web2py Safety discussion

2013-06-02 Thread BlueShadow
I wrote just a simple few lines to display the contents of that file to my personal Admin report^^ h2Failed logins to Adminpanel:/h2 {{deny=os.path.join('applications', 'admin', 'private', 'hosts.deny')}} {{file=open(deny,'r')}} {{lines=file.readlines()}} {{file.close()}} {{for l in lines:}}

[web2py] dynamic navigation based on user group

2013-06-02 Thread lesssugar
A web2py newbie says hi to everyone :) In my app I'm planning to have a sidebar navigation for users of 3 groups: 1. user who's NOT logged in 2. user who IS logged in and stored in db as group 2 3. user who IS logged in and stored in db as group 3 So the 3 user groups have different navigations,

[web2py] Re: is this a new feature?

2013-06-02 Thread Alan Etkin
As i remember, one year ago, I had to include the referenced table in the query, so that it can be used in the select. Can you give us a source code example of the problem/question? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To

[web2py] Re: dynamic navigation based on user group

2013-06-02 Thread Alan Etkin
Now, how do I prepare such menu in my controller and then implement it in the view? What's the best way? (somewhere in the model) custom_menu = None (at the top of the controller) if not auth.user: custom_menu = MENU(...) # dirty fork menu elif auth.has_membership(role=group 1):

[web2py] list:reference requires is not empty

2013-06-02 Thread BlueShadow
when one has a database field with a list:reference type it can be empty. For quite a few scenarios this is undesirable. but if you use requires is_not_empty() it first of all doesn't show the reference table entries. And it still allows you to leave the field empty. -- --- You received

[web2py] Re: dynamic navigation based on user group

2013-06-02 Thread lesssugar
Thanks, Alan, great post. And it seems very easy. On Sunday, June 2, 2013 1:58:24 PM UTC+2, Alan Etkin wrote: Now, how do I prepare such menu in my controller and then implement it in the view? What's the best way? (somewhere in the model) custom_menu = None (at the top of the

[web2py] db field requires is empty

2013-06-02 Thread BlueShadow
I got a database field which needs to be filled when a bolean is true and when its not true it should be empty. Thats what I did: Field('Booleancheck','boolean'), Field('Type','reference Type_table', requires=IS_IN_DB (db,'type_table.id', 'type_table.Name') if request.vars.Booleancheck else

[web2py] Re: list:reference requires is not empty

2013-06-02 Thread Massimo Di Pierro
The IS_NOT_EMPTY validator is not compatible with a list:string field. A list can have zero elements. What you want it IS_LIST_OF(other_validator_for_elements, minimum, maximum) On Sunday, 2 June 2013 07:14:19 UTC-5, BlueShadow wrote: when one has a database field with a list:reference type

[web2py] Re: db field requires is empty

2013-06-02 Thread Massimo Di Pierro
I would use javascript for this. I may ba adding logic in web2py to do this soon. On Sunday, 2 June 2013 08:01:45 UTC-5, BlueShadow wrote: I got a database field which needs to be filled when a bolean is true and when its not true it should be empty. Thats what I did:

[web2py] Re: username and email login (auth)

2013-06-02 Thread Massimo Di Pierro
Do you need the commented lines? #request.vars.email = request.vars.username request.post_vars.email = request.vars.email #request.vars.username = None request.post_vars.username = None On Saturday, 1 June 2013 21:27:05 UTC-5, Gustavo Souza wrote:

[web2py] Re: db field requires is empty

2013-06-02 Thread Anthony
As Massimo suggested, you should use Javascript to disable the Type input when the boolean remains unchecked (and reset Type if an option was selected and the boolean subsequently unchecked). But if you also want to validate on the server (which isn't a bad idea), you might try IS_LENGTH(0),

[web2py] Update view from Scheduler?

2013-06-02 Thread Joel McGraw
Web2py noob here: I have a long-running Scheduler task that is updating a record-count. The record count is displayed in a view. How would one update the view when the Scheduler updates the record count? -- --- You received this message because you are subscribed to the Google Groups

[web2py] Re: Update view from Scheduler?

2013-06-02 Thread Alan Etkin
How would one update the view when the Scheduler updates the record count? Instead of having the scheduled task update the value in the client (I cannot think of a web2py feature able to make that), you could use a self-updated component with the LOAD helper timing options. If you have an

[web2py] Re: Beginning advice

2013-06-02 Thread Darin Lawson Hosking
Correct this is a data modelling question. Based on the strengths and flexibility web2py I am trying to figure out how to model the process I described. Is it better to use separate tables for issues, objectives, actions, and ranking then use queries etc to link them together? If so is it

[web2py] Few controllers in the same basic layout

2013-06-02 Thread lesssugar
OK, this might be a silly one. My app uses one main view (layout.html), which is extended by every other one. layout.html has a login form included, created in default.py controller (the form is supposed to be at hand until user signs in). Now, whenever I use any other controller, I get an

[web2py] Re: Beginning advice

2013-06-02 Thread Alex Glaros
Darin, I'm a newbie also and Web2py plug-in wiki may do the job. If not, off the top of my head the data model roughly seems to be as follows. I could have misread the concepts, but here's a general idea. auth_user table (web2py automatically creates this. It would be like PersonTable if not

[web2py] Re: is this a new feature?

2013-06-02 Thread webpypy
I am sorry. I am the problem. I should use outer join. I was confused , because not mentioning the reference table in the query and mentioning it in the select, will generate product of the tables. Again, I am sorry. Regards, Ashraf On Sunday, June 2, 2013 2:21:25 PM UTC+3, Alan Etkin

[web2py] is_upper() no found

2013-06-02 Thread Luis Díaz
greetings to all. in the following model (which generally works well) http://pastebin.com/DkUvq29r when the user enters values in the group are not changed to uppercase by the system .. bone does not apply is_upper () that Requires to define in this field the controller is as follows:

[web2py] Re: Few controllers in the same basic layout

2013-06-02 Thread Massimo Di Pierro
On Sunday, 2 June 2013 17:15:55 UTC-5, lesssugar wrote: OK, this might be a silly one. My app uses one main view (layout.html), which is extended by every other one. layout.html has a login form included, created in default.py controller (the form is supposed to be at hand until user