Re: [web2py] Getting drop-down value names from grandparent record

2012-07-10 Thread Johann Spies
On 10 July 2012 01:09, MichaelF mjfs...@gmail.com wrote: lambda r: '%s' % (db.I1[db.C1_2[r.C1_2].I1].Name), _and=IS_NOT_IN_DB(db(db.C1_2_3.C1_2==request.vars.C1_2), 'C1_2_3.C3')) db.C1_2_3.C1_2.requires=IS_IN_DB(db, 'C1_2.id', ... 1. Am I even allowed to have a lambda function

[web2py] Re: with versioning how can you list the deleted records

2012-07-10 Thread simon
On Monday, 9 July 2012 23:46:11 UTC+1, Massimo Di Pierro wrote: When versioning is on and you delete a record, the record is not actually deleted but is_active is set to False. All queries for tables for versioning automatically add a query is_active==True to filter them out and you no

Re: [web2py] default function in a non default controller with args - routing

2012-07-10 Thread Francisco Costa
Thanks Anthony and Jonathan. It works! It would be nice to have this routing documentation updated in the online book. On Monday, July 9, 2012 10:58:22 PM UTC+1, Jonathan Lundell wrote: On 9 Jul 2012, at 1:29 PM, Francisco Costa wrote: I'm using the Parameter-based system for routing In

[web2py] building site menu from database

2012-07-10 Thread Alan
hi, wonder if i could have some input please on where im going wrong, spent a few hours getting my head round this, but can't seem to get it right. taking inspiration from this: http://wizardinternetsolutions.com/web-database-design/single-query-dynamic-multi-level-menu/ I am trying to build

[web2py] Re: building site menu from database

2012-07-10 Thread villas
I also tried implementing menus based on a DB table so that I could display options which related to user permissions. However, in the end it became rather complicated and I decided it wasn't worth the effort and I went back to some kind of simple text representation. For simplicity, I

Re: [web2py] Re: [Version 1.96.4] DAL timing issue.

2012-07-10 Thread Santiago Gilabert
Hello, Limiting the number of rows or removing the virtual field, it works. So, as far as I understand, this is an issue related to the virtual field defined for voting_center. It also works if I use db.executesql to get the id's and then db.voting_center(id) to load the voting_center record. I

Re: [web2py] Re: building site menu from database

2012-07-10 Thread Richard Vézina
In order to have some kind of conditionnal menu I do that : menu_entry1 = [T('entry1', False, '', # First level goes no where [ [T('sub1_1'), False, URL(request.application, 'CONTROLLER',

Re: [web2py] Re: building site menu from database

2012-07-10 Thread Richard Vézina
Sometimes I have to duplicate first level menu entry and I don't like that... Richard On Tue, Jul 10, 2012 at 8:59 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: In order to have some kind of conditionnal menu I do that : menu_entry1 = [T('entry1', False,

Re: [web2py] default function in a non default controller with args - routing

2012-07-10 Thread Anthony
Thanks Anthony and Jonathan. It works! It would be nice to have this routing documentation updated in the online book. +1 For now, there's quite a bit in the routers.example.py file (including the detail about making functions a dictionary of lists). Anthony

Re: [web2py] Multiple select Web2py

2012-07-10 Thread Richard Vézina
Would need to see the model and your controller function that create the form... Richard On Tue, Jul 10, 2012 at 12:50 AM, Kevin Miller kevinvani...@gmail.comwrote: Hi all, I have a multiple select that I attach to a auth user profile. However, after I save the profile and log back in, I

[web2py] Routing broke between 2012-06-18 and 2012-07-10

2012-07-10 Thread Alec Taylor
My routing broke between these two versions: Version 2.00.0 (2012-06-18 17:07:27) dev Version 2.00.0 (2012-07-10 00:22:32) dev So in my db.py I have a line: `auth.settings.login_next = URL(f='profile')` Which is meant to redirect user to \profile\ once user is logged in. Going to

[web2py] Re: Routing broke between 2012-06-18 and 2012-07-10

2012-07-10 Thread Anthony
We just made a change to auth.navbar() so the login link is now treated like the other links. By default, the URL of the current page the user is on is added as a referrer to the query string of the login link (as well as all the other navbar links, except logout). After login, the user is

Re: [web2py] Routing broke between 2012-06-18 and 2012-07-10

2012-07-10 Thread Jonathan Lundell
On 10 Jul 2012, at 7:51 AM, Alec Taylor wrote: My routing broke between these two versions: Version 2.00.0 (2012-06-18 17:07:27) dev Version 2.00.0 (2012-07-10 00:22:32) dev So in my db.py I have a line: `auth.settings.login_next = URL(f='profile')` Which is meant to redirect user to

Re: [web2py] Multiple select Web2py

2012-07-10 Thread Kevin Miller
Thanks for your reply. The form is auto generated by web2py. It is the profile link you click on when you log in the system. On Tue, Jul 10, 2012 at 8:25 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Would need to see the model and your controller function that create the form...

Re: [web2py] Re: building site menu from database

2012-07-10 Thread villas
Hi Richard, What you suggest is easy to do -- for us, but this could not be maintained by one of my average users. I was making a solution which would be easy for anyone to maintain, and the plugin_wiki style menu is great for that. I am not sure what Alan's underlying requirements are (the

Re: [web2py] Re: Routing broke between 2012-06-18 and 2012-07-10

2012-07-10 Thread Alec Taylor
On Wed, Jul 11, 2012 at 1:40 AM, Anthony abasta...@gmail.com wrote: We just made a change to auth.navbar() so the login link is now treated like the other links. By default, the URL of the current page the user is on is added as a referrer to the query string of the login link (as well as all

Re: [web2py] default function in a non default controller with args - routing

2012-07-10 Thread Jonathan Lundell
On 10 Jul 2012, at 6:14 AM, Anthony wrote: Thanks Anthony and Jonathan. It works! It would be nice to have this routing documentation updated in the online book. +1 For now, there's quite a bit in the routers.example.py file (including the detail about making functions a dictionary of

[web2py] Re: building site menu from database

2012-07-10 Thread villas
Hi Alan Here is some test code using recursion I used to create a menu in the past. I used it in a module but you can test it easily for yourself at the commandline as I will explain. def test_html_nodes(nodes,link_to_function='area'): if not nodes: nodes = [ { 'id':1,

[web2py] Re: building site menu from database

2012-07-10 Thread villas
Oops my copy and paste wasn't perfect, the function I posted should end with: return output On Tuesday, July 10, 2012 5:15:12 PM UTC+1, villas wrote: Hi Alan Here is some test code using recursion I used to create a menu in the past. I used it in a module but you can test it

[web2py] db.py request.vars

2012-07-10 Thread Hassan Alnatour
Dear ALL, Can i use an if in the db.py depending in the request.vars ? i created some extra Fields to the auth_user table and one Field uses a list so if the user/register page has the lan=en i want to use another list , how do you think i can do this ?

[web2py] Re: Issue getting Janrain working

2012-07-10 Thread Massimo Di Pierro
In trunk. Thank you. On Tuesday, 10 July 2012 00:09:50 UTC-5, Dave wrote: I figured it out... The trunk welcome (and all default apps) are missing the conditional for the reset password in the view... Here is a patch: --- welcome/views/default/user.html 2012-07-04 17:54:18.0

[web2py] Re: Has anyone done a detailed security analysis or attempted a methodical attack on web2py?

2012-07-10 Thread Dave
Well I can't say that I have tested the current trunk version, but last December I ran a pretty exhaustive penetration test against a site developed web2py. The results were very good. No findings above low. The low findings were insignificant. I ran Cenzic Hailstorm, Qualys and one

[web2py] Re: with versioning how can you list the deleted records

2012-07-10 Thread Massimo Di Pierro
Make sure your app uses the latest appadmin.py from welcome. The new one ignores filters. The old one does not because filters did not exist. On Tuesday, 10 July 2012 02:37:42 UTC-5, simon wrote: Thanks. I saw the is_active column in admin but they were all true! Would be useful to have a

Re: [web2py] Re: [Version 1.96.4] DAL timing issue.

2012-07-10 Thread Massimo Di Pierro
I do not understand. Why are you doing this? for (id, ) in db.executesql(db(db.voting_center)._select(db.voting_center.id, orderby='id')): reg = db.voting_center(id) Thats's N+1 select()s where N is the number of records. On Tuesday, 10 July 2012 07:21:37 UTC-5, Santiago wrote:

[web2py] Re: db.py request.vars

2012-07-10 Thread Massimo Di Pierro
yes. Field(requires=IS_IN_SET(LIST1 if request.vars.x==y else LIST2)) On Tuesday, 10 July 2012 11:22:46 UTC-5, Hassan Alnatour wrote: Dear ALL, Can i use an if in the db.py depending in the request.vars ? i created some extra Fields to the auth_user table and one Field uses a list

[web2py] Authorization w/ Janrain

2012-07-10 Thread Dave
I spent some time searching for this and have not come up with much. Has anybody implemented or tried to implement user authorization (read: limit users that may sign in) with Janrain? I think there are two possibilities here... The first possibility falls under standard authorization where

Re: [web2py] Multiple select Web2py

2012-07-10 Thread Richard Vézina
Ok, so must be a issue with web2py... Which version are you using? Maybe open issue on google code. Richard On Tue, Jul 10, 2012 at 11:48 AM, Kevin Miller kevinvani...@gmail.comwrote: Thanks for your reply. The form is auto generated by web2py. It is the profile link you click on when you

Re: [web2py] Re: [Version 1.96.4] DAL timing issue.

2012-07-10 Thread Santiago Gilabert
Because the same query, using raw sql is resolved in seconds. The reason I do reg = db.voting_center(id) is because I need the voting_center object. If I do this: for reg in db(db.voting_center).select(): It takes a lot of time to get resolved (40 mins, maybe more ...). On Tue, Jul 10, 2012

[web2py] Re: Has anyone done a detailed security analysis or attempted a methodical attack on web2py?

2012-07-10 Thread Massimo Di Pierro
Thank you Dave for the feedback. It would be nice to have the results of those tests (Cenznic, Hailstorm, Quails) published somewhere. Once in a while people ask about this. Massimo On Tuesday, 10 July 2012 11:28:39 UTC-5, Dave wrote: Well I can't say that I have tested the current

[web2py] Re: Authorization w/ Janrain

2012-07-10 Thread Massimo Di Pierro
Your problem is limiting the number of users who can sign in. I am not sure this is a janrain issue. You need to handle it somehow at the web2py level and it should be independent on which method you use for authentication (janrain or other). It can be done but how it is done depends on the

Re: [web2py] Re: [Version 1.96.4] DAL timing issue.

2012-07-10 Thread Massimo Di Pierro
Please do the tests I asked. Time time: rows = db(db.voting_center).select(...) where ... is a list of fields. Start with one field and add one field at the time. What timing do you get? You may have a virtual field that causes the slow down. This is an effect of your code or an effect of low

[web2py] web2py - pypy 1.9

2012-07-10 Thread Derek
Just an FYI - I tested running web2py on pypy 1.9... No handlers could be found for logger web2py web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.99.7 (2012-03-04 22:12:08) stable Database drivers available: SQLite3, pymysql, pg8000, IMAP Starting hardcron...

[web2py] Re: Authorization w/ Janrain

2012-07-10 Thread Dave
Agreed. It is not a Janrain specific issue, I am sure the same applies for other non-local authentication schemes. In other systems I have implemented in the past I would allow authentication externally, but configured authorization separately. An example from my past: I have a webapp that

[web2py] Re: web2py - pypy 1.9

2012-07-10 Thread Massimo Di Pierro
Please try two things: 1) run with web2py.py -N this will disable cron and the cron error message. 2) python the pypy shell (without web2py) try import pymysql (it is in web2py/gluon/contrib). On Tuesday, 10 July 2012 13:12:11 UTC-5, Derek wrote: Just an FYI - I tested running web2py on

[web2py] Re: web2py - pypy 1.9

2012-07-10 Thread Derek
C:\Temp\web2pycd gluon C:\Temp\web2py\gluoncd contrib C:\Temp\web2py\gluon\contribc:\pypy-1.9\pypy.exe Python 2.7.2 (341e1e3821ff, Jun 07 2012, 15:43:00) [PyPy 1.9.0 with MSC v.1500 32 bit] on win32 Type help, copyright, credits or license for more information. And now for something completely

[web2py] pre selected checkboxes

2012-07-10 Thread Fabiano Faver
I want to creat something similar to SQLFORM(auth_membership) but I want the user to choose a group and all users show up as checkboxes and users who already belong to this group are checked as well. I`m downt know how to pre-select these auth_users. any tips?

[web2py] Re: web2py - pypy 1.9

2012-07-10 Thread Derek
and FYI, using the command line option -N does in fact remove the error message about cron. On Tuesday, July 10, 2012 11:38:38 AM UTC-7, Derek wrote: C:\Temp\web2pycd gluon C:\Temp\web2py\gluoncd contrib C:\Temp\web2py\gluon\contribc:\pypy-1.9\pypy.exe Python 2.7.2 (341e1e3821ff, Jun 07

Re: [web2py] pre selected checkboxes

2012-07-10 Thread Richard Vézina
in your model Field(..., default=True) or in the controller db.table.field.default=True You also need to use checkbox widget. Richard On Tue, Jul 10, 2012 at 2:39 PM, Fabiano Faver far...@gmail.com wrote: I want to creat something similar to SQLFORM(auth_membership) but I want the user to

[web2py] Cherokee + uWSGI + web2py caching

2012-07-10 Thread Athelionas
I've been experimenting with deploying web2py on a Cherokee server with uWSGI. Everything works perfectly fine, although there's still room for improvements. First thing that comes to mind is caching. Problem is this topic can be very confusing for a newcomer like me as Cherokee, uWSGI, and

Re: [web2py] pre selected checkboxes

2012-07-10 Thread Fabiano Faver
Won`t it apply True to all of them? this is what I have now with sqlform: Field('users', requires = IS_IN_DB(db, db.auth_user, '%(email)s', multiple=True), widget=SQLFORM.widgets.checkboxes.widget ) I imagined there were a argument using lambda that would set 'checked' for each checkbox

[web2py] Re: building site menu from database

2012-07-10 Thread Alan
thank you for the code villas, will have a play. i didn't think my attempt was for anything complicated personally, i just wanted to output an array in the same syntax as response.menu but with all results coming from a single 'page' table in a database. I was trying to think of the best way

Re: [web2py] pre selected checkboxes

2012-07-10 Thread Richard Vézina
default=lambda row: row.check_box_field Richard On Tue, Jul 10, 2012 at 4:03 PM, Fabiano Faver far...@gmail.com wrote: Won`t it apply True to all of them? this is what I have now with sqlform: Field('users', requires = IS_IN_DB(db, db.auth_user, '%(email)s', multiple=True),

Re: [web2py] pre selected checkboxes

2012-07-10 Thread Fabiano Faver
controller: def gerenciar_grupos(): form_not_usu = SQLFORM.factory( Field('usuarios', requires=IS_IN_DB(db, db.auth_user,'%(email)s',multiple=True),widget=SQLFORM.widgets.checkboxes.widget, default=True), ) return dict( form_not_usu = form_not_usu) view:

[web2py] Re: building site menu from database

2012-07-10 Thread Alan
I only went and figured it outstrings! response.ttt = db((db.page.showinmenu==1)(db.page.active==1)).select(db.page.id, db.page.menutext, db.page.pageurl, db.page.parent, orderby=db.page.parent|db.page.sort|db.page.menutext) response.tttmenu = [[],dict()] for subpage in response.ttt:

[web2py] Re: building site menu from database

2012-07-10 Thread Cliff Kachinske
I believe the only reason for putting something like this in the db is so the user can configure it. I can see where that might be useful, but have you considered what the user interface will look like? Following the principle of least surprise, it should look like a generic file manager tree

[web2py] Re: building site menu from database

2012-07-10 Thread villas
I believe the only reason for putting something like this in the db is so the user can configure it. I can see where that might be useful, but have you considered what the user interface will look like? @Cliff +1 you summarized it well :)

[web2py] routes.py vs mod_rewrite

2012-07-10 Thread Athelionas
What is the preferred way of rewriting URLs? Also, are there any advantages or disadvantages of choosing one over the other? I like the idea of routes.py better because of portability, but is it any good in case of static files?

[web2py] Re: Broken admin in trunk?

2012-07-10 Thread Dave
the /admin app only works either over https or via 127.0.0.1 / ::1 You can hack the app to change that, but it is default behavior On Tuesday, July 10, 2012 5:04:43 PM UTC-4, Michael Toomim wrote: I just upgraded to the trunk. I'm trying to log into the admin, but there's no password entry

[web2py] Re: building site menu from database

2012-07-10 Thread Alan
once it works to build in this fashion: response.menu = [ ('Home', False, URL('page','index'), []) ] shouldn't this then be a question for web2py devs rather than me?

Re: [web2py] Re: Broken admin in trunk?

2012-07-10 Thread Michael Toomim
That's not the problem. I've already hacked it. That displays admin disabled because insecure channel. On Jul 10, 2012, at 3:00 PM, Dave wrote: the /admin app only works either over https or via 127.0.0.1 / ::1 You can hack the app to change that, but it is default behavior On Tuesday,

[web2py] Re: Authorization w/ Janrain

2012-07-10 Thread Massimo Di Pierro
How about this: AUTHORIZED_EMAILS = ['t...@example.com'] url1 = URL('default','you_are_not_authorized') auth.settings.extra_fields['auth_user']=[Field('authorized','boolean',default=False,compute=lambda row: row.email in AUTHORIZED_EMAILS)] if auth.user and not auth.user.authorized and not

[web2py] Re: routes.py vs mod_rewrite

2012-07-10 Thread Massimo Di Pierro
routes.py works for all web2py urls, including static files. On Tuesday, 10 July 2012 16:51:54 UTC-5, Athelionas wrote: What is the preferred way of rewriting URLs? Also, are there any advantages or disadvantages of choosing one over the other? I like the idea of routes.py better because

Re: [web2py] Re: Broken admin in trunk?

2012-07-10 Thread Massimo Di Pierro
The normal behavior is, as Dave indicated, that you must be over https or from localhost. The change in trunk is that the condition is false, the login form is not even displayed to prevent you from accidentally submitting credentials over insecure channel. You have hacked admin to bypass

Re: [web2py] Re: Broken admin in trunk?

2012-07-10 Thread Michael Toomim
Ah, so I was wrong, great, thank you! On Jul 10, 2012, at 3:20 PM, Massimo Di Pierro wrote: The normal behavior is, as Dave indicated, that you must be over https or from localhost. The change in trunk is that the condition is false, the login form is not even displayed to prevent you from

[web2py] Any jquery gurus out there?

2012-07-10 Thread RKS
I know this is probably not the right place to ask, but I am using w2p and post here pretty frequently so I figured what the heck. I'm also in a rush and not finding out what I need on stackoverflow. I have some jquery and it works in every browser except any version of IE. If you happen to

[web2py] Re: web2py vs ROR

2012-07-10 Thread G. Clifford Williams
I think I'm in a pretty good position to talk about modifying things in web2py as I recently took the template engine created for web2py and separated it out as a library that can be integrated with other projects. In addition, I've been using the framework since ~ late 2008. There are several

[web2py] Re: routes.py vs mod_rewrite

2012-07-10 Thread G. Clifford Williams
personally I always go with routes.py On Tuesday, July 10, 2012 4:51:54 PM UTC-5, Athelionas wrote: What is the preferred way of rewriting URLs? Also, are there any advantages or disadvantages of choosing one over the other? I like the idea of routes.py better because of portability, but

[web2py] Re: routes.py vs mod_rewrite

2012-07-10 Thread Anthony
routes.py will also handle rewriting outgoing URLs via the URL() function. Anthony On Tuesday, July 10, 2012 5:51:54 PM UTC-4, Athelionas wrote: What is the preferred way of rewriting URLs? Also, are there any advantages or disadvantages of choosing one over the other? I like the idea of

[web2py] Re: Cherokee + uWSGI + web2py caching

2012-07-10 Thread pbreit
First, if you are worried about performance at all, use Nginx + uWSGI. Cherokee is essentially abandoned. The two areas of caching that might be helpful are 1) static assets like images and 2) database queries. For static assets, I suggest using the free CDN, Cloudflare. For database queries,

[web2py] template.render() and whitespace

2012-07-10 Thread Rob
Hi, I'm using the standalone template.py to generate non html files and the excess whitespace is making this somewhat painful. For example, my view: #ifndef __BLAH__ #define __BLAH__ {{for d in data[:3]:}} {{= hi}} {{pass}} #endif outputs: #ifndef __BLAH__ #define __BLAH__

Re: [web2py] Re: routes.py vs mod_rewrite

2012-07-10 Thread Jonathan Lundell
On 10 Jul 2012, at 4:49 PM, Anthony wrote: routes.py will also handle rewriting outgoing URLs via the URL() function. And by default, the parametric router doesn't shorten static URLs, so as to make them easier to handle via Apache's mod_rewrite or the like. Anthony On Tuesday, July 10,

Re: [web2py] Multiple select Web2py

2012-07-10 Thread Kevin Miller
I am using the Nightly Build as I need twitter bootstrap :-) On Tue, Jul 10, 2012 at 11:41 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Ok, so must be a issue with web2py... Which version are you using? Maybe open issue on google code. Richard On Tue, Jul 10, 2012 at 11:48 AM,

[web2py] Re: template.render() and whitespace

2012-07-10 Thread Massimo Di Pierro
You can do {{for d in data[:3]: = hi pass}} to achieve when you want. On Tuesday, 10 July 2012 16:08:40 UTC-5, Rob wrote: Hi, I'm using the standalone template.py to generate non html files and the excess whitespace is making this somewhat painful. For example, my

Re: [web2py] Getting drop-down value names from grandparent record

2012-07-10 Thread MichaelF
Didn't help. I now get the same error, this time in the function. Any idea what the error message is trying to tell me? On Tuesday, July 10, 2012 12:50:01 AM UTC-6, Johann Spies wrote: On 10 July 2012 01:09, MichaelF mjfs...@gmail.com wrote: lambda r: '%s' %

Re: [web2py] Any jquery gurus out there?

2012-07-10 Thread Jason Brower
What is it that isn't working in IE? On 07/11/2012 01:54 AM, RKS wrote: I know this is probably not the right place to ask, but I am using w2p and post here pretty frequently so I figured what the heck. I'm also in a rush and not finding out what I need on stackoverflow. I have some jquery