[web2py] admin access password file
Hi all, I have to migrate a web2py app to a centos server. It has python 2.6.6, uwsgi 1.9.12. admin fails saying: admin disabled because unable to access password file the file (parameters_443.py) is there. I tried to debug the failure and I discover that, despite the fact that I use https, it tries to access parameters_80.py. Thus, I created the file parameters_80.py but then it fails saying to use https :(. Paolo -- --- 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: Web Development Introduction Based On Web2py
Hi Folks, I am going through this excellent tutorial. I am stuck at this section: http://killer-web-development.com/section/5/4. The section tells me the create a menu. Which I did. In the menu all the links work fine. Ex. the help menu goes to: http://127.0.0.1:8000/tukker/default/help. As expected. But the login menu goes to: http://127.0.0.1:8000/default/user/login and this throws up a invalid request. My menu.py looks like this: response.menu = [ (T('Home'), False, URL('default', 'index'), []), (T('Help'), False, URL('default', 'help'), []), (T('Login'), False, URL('default', 'user', 'login'), []), (T('Privacy'), False, URL('default', 'privacy'), []), ] Am I doing something wrong? Please advice. Regards, Sundar On Thursday, June 6, 2013 11:37:31 PM UTC+5:30, Sundar Nadimpalli wrote: Wow. Very happy to note that. ~~ Hi Marco, I have a heard lot of praise for your tutorial and can't wait to get started. But your site is down and returns a 502. I know that you may be busy with other things, but still I would like to request you to consider bringing the site back up. Thanks, Sundar On Wednesday, December 21, 2011 12:03:21 AM UTC+5:30, ma...@rockiger.com wrote: I published the first 3 chapters of my web development tutorial at http://killer-web-development.com It's aimed at total web development beginners and uses web2py as framework. The idea was to write a web development tutorial based on web2py, because web2py is the easiest to use web development solution - maybe I can rescue a few people from starting with PHP. The book aims to be an mixture of railstutorial.org and the Head First series. Lots of images and very low level subject matter. A the end readers will develop a full microblogging service. I would appreciate any feedback. Best marco -- --- 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. -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/pL9L2kgdGxA/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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] Save rendered .html views to file system
In my application the header and footer of the layout, contain more or less static information (navbar, address, social etc.) Since this header and footer are shared by all users, their content is stored in a database. The problem is that on every request the database is queried for this 'semi' static content. I wonder whether it is possible to render the header and footer when the user edits his navigation, address etc. in the cms and then store it in a sub folder in the static folder and in layout.html have something like: {{include user_id_header}} {{include}} {{include user_id_footer}} where user_id_header and user_id_footer reference rendered .html files in 'static/user_6/header.html' and 'static/user_6/footer.html' respectively. Kind regards, Annet -- --- 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] Default template file
Hi, I have a question. Currently there is a file views/layout.html, default view is possible to change with response.view = 'shared/entry_value_grid.html' is it possible to change default template view? -- --- 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] smartgrid breadcrumbs
Hello, sorry to bother you guys but I can figure it out how I can solve this problem. I have the following tables: db.define_table('t_unit', Field('f_unit', type='string', label=T('Unit')), auth.signature, format='%(f_unit)s', singular=Unit, migrate=settings.migrate) db.define_table('t_offices', Field('f_office', type='string', label=T('Office number')), auth.signature, singular=Office, format='%(f_office)s', migrate=settings.migrate) db.define_table('t_unit_offices', Field('f_unit', 'reference t_unit', label=T('Unit')), Field('f_office', 'reference t_offices', label=T('Office')), auth.signature, singular=Office, format= '%(f_office)s', migrate=settings.migrate) Is a many to many relationship. One unit can have many offices and one office can be shared by more than one unit. I'm displaying it with a smartgrid: assets = SQLFORM.smartgrid(db.t_unit, linked_tables=['t_unit_offices'], csv = False, deletable = True, editable = True, create = True, paginate=100 ) That works well. But now I need to have the following relationship: one specific office in one unit have many computers (1:n) I created the following table: db.define_table('t_computers', Field('f_office', 'reference t_unit_offices', label=T('Office')), Field('f_inv_nr', type='string', label=T('Inventory number')), Field('f_stag', type='string', label=T('ST')), auth.signature, format='%(f_inv_nr)s', singular=Computer, plural=Computers, migrate=settings.migrate) and modified the smartgrid definition like that: assets = SQLFORM.smartgrid(db.t_unit, linked_tables=['t_unit_offices', 't_computers'], csv = False, deletable = True, editable = True, create = True, paginate=100 ) It works well but when I click in the Hardwares link it shows the following in the breadcrumbs: UnitsA1Offices*8*Hardware How can I manage to get the name of the office instead of the id? Thank you very much for all. Kind regards. -- --- 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: Web Development Introduction Based On Web2py
Try changing the third line in to (T('Login'), False, URL('default', 'user'), []), and see whether it makes a difference. Do you still have a 'def user():' function in your default controller? Regards Johann Do On 12 June 2013 09:28, Sundar Nadimpalli sun...@signumsol.com wrote: Hi Folks, I am going through this excellent tutorial. I am stuck at this section: http://killer-web-development.com/section/5/4. The section tells me the create a menu. Which I did. In the menu all the links work fine. Ex. the help menu goes to: http://127.0.0.1:8000/tukker/default/help. As expected. But the login menu goes to: http://127.0.0.1:8000/default/user/login and this throws up a invalid request. My menu.py looks like this: response.menu = [ (T('Home'), False, URL('default', 'index'), []), (T('Help'), False, URL('default', 'help'), []), (T('Login'), False, URL('default', 'user', 'login'), []), (T('Privacy'), False, URL('default', 'privacy'), []), ] Am I doing something wrong? Please advice. Regards, Sundar On Thursday, June 6, 2013 11:37:31 PM UTC+5:30, Sundar Nadimpalli wrote: Wow. Very happy to note that. ~~** Hi Marco, I have a heard lot of praise for your tutorial and can't wait to get started. But your site is down and returns a 502. I know that you may be busy with other things, but still I would like to request you to consider bringing the site back up. Thanks, Sundar On Wednesday, December 21, 2011 12:03:21 AM UTC+5:30, ma...@rockiger.com wrote: I published the first 3 chapters of my web development tutorial at http://killer-web-development.**comhttp://killer-web-development.com It's aimed at total web development beginners and uses web2py as framework. The idea was to write a web development tutorial based on web2py, because web2py is the easiest to use web development solution - maybe I can rescue a few people from starting with PHP. The book aims to be an mixture of railstutorial.org and the Head First series. Lots of images and very low level subject matter. A the end readers will develop a full microblogging service. I would appreciate any feedback. Best marco -- --- 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+unsubscribe@**googlegroups.comweb2py%2bunsubscr...@googlegroups.com . For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/pL9L2kgdGxA/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/pL9L2kgdGxA/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@**googlegroups.comweb2py%2bunsubscr...@googlegroups.com . For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- 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. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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: Web Development Introduction Based On Web2py
Thanks for the reply. I did what you suggested but I get an error: list index out of rangeThe def user(): function is there in the default controller. If I manually change the URL to: http://127.0.0.1:8000/tukker/default/user/login. I get the right page. ~~ Sundar Ramanujam Nadimpalli On Wed, Jun 12, 2013 at 2:45 PM, Johann Spies johann.sp...@gmail.comwrote: Try changing the third line in to (T('Login'), False, URL('default', 'user'), []), and see whether it makes a difference. Do you still have a 'def user():' function in your default controller? Regards Johann Do On 12 June 2013 09:28, Sundar Nadimpalli sun...@signumsol.com wrote: Hi Folks, I am going through this excellent tutorial. I am stuck at this section: http://killer-web-development.com/section/5/4. The section tells me the create a menu. Which I did. In the menu all the links work fine. Ex. the help menu goes to: http://127.0.0.1:8000/tukker/default/help. As expected. But the login menu goes to: http://127.0.0.1:8000/default/user/login and this throws up a invalid request. My menu.py looks like this: response.menu = [ (T('Home'), False, URL('default', 'index'), []), (T('Help'), False, URL('default', 'help'), []), (T('Login'), False, URL('default', 'user', 'login'), []), (T('Privacy'), False, URL('default', 'privacy'), []), ] Am I doing something wrong? Please advice. Regards, Sundar On Thursday, June 6, 2013 11:37:31 PM UTC+5:30, Sundar Nadimpalli wrote: Wow. Very happy to note that. ~~** Hi Marco, I have a heard lot of praise for your tutorial and can't wait to get started. But your site is down and returns a 502. I know that you may be busy with other things, but still I would like to request you to consider bringing the site back up. Thanks, Sundar On Wednesday, December 21, 2011 12:03:21 AM UTC+5:30, ma...@rockiger.com wrote: I published the first 3 chapters of my web development tutorial at http://killer-web-development.**comhttp://killer-web-development.com It's aimed at total web development beginners and uses web2py as framework. The idea was to write a web development tutorial based on web2py, because web2py is the easiest to use web development solution - maybe I can rescue a few people from starting with PHP. The book aims to be an mixture of railstutorial.org and the Head First series. Lots of images and very low level subject matter. A the end readers will develop a full microblogging service. I would appreciate any feedback. Best marco -- --- 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+unsubscribe@**googlegroups.comweb2py%2bunsubscr...@googlegroups.com . For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/pL9L2kgdGxA/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/pL9L2kgdGxA/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@**googlegroups.comweb2py%2bunsubscr...@googlegroups.com . For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- 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. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/pL9L2kgdGxA/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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: Save rendered .html views to file system
Hi, you could use cache.ram or cache.disc. Start by replacing the {{include 'footer.html' }} with something like: {{=response.render('footer.html', {your dict} )}} and then wrap that like {{=cache.ram( YOUR_KEY, lambda: response.render('footer.html', {your dict} ) , time_expire=YOUR_TIME_EXPIRE)}} footer.html will be rendered either if the key hasn't cached already or it is no longer valid (expired). Hope it helps Paolo On Wednesday, June 12, 2013 10:04:07 AM UTC+2, Annet wrote: In my application the header and footer of the layout, contain more or less static information (navbar, address, social etc.) Since this header and footer are shared by all users, their content is stored in a database. The problem is that on every request the database is queried for this 'semi' static content. I wonder whether it is possible to render the header and footer when the user edits his navigation, address etc. in the cms and then store it in a sub folder in the static folder and in layout.html have something like: {{include user_id_header}} {{include}} {{include user_id_footer}} where user_id_header and user_id_footer reference rendered .html files in 'static/user_6/header.html' and 'static/user_6/footer.html' respectively. Kind regards, Annet -- --- 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: Web Development Introduction Based On Web2py
On 12 June 2013 11:33, Sundar Nadimpalli sun...@signumsol.com wrote: Thanks for the reply. I did what you suggested but I get an error: list index out of rangeThe def user(): function is there in the default controller. If I manually change the URL to: http://127.0.0.1:8000/tukker/default/user/login. I get the right page. Then (T('Login'), False, URL('default', 'user/login'), []), should work. Regards Johann --- 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. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- 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: Web Development Introduction Based On Web2py
Thank you very much. That worked. ~~ Sundar Ramanujam Nadimpalli On Wed, Jun 12, 2013 at 3:25 PM, Johann Spies johann.sp...@gmail.comwrote: On 12 June 2013 11:33, Sundar Nadimpalli sun...@signumsol.com wrote: Thanks for the reply. I did what you suggested but I get an error: list index out of rangeThe def user(): function is there in the default controller. If I manually change the URL to: http://127.0.0.1:8000/tukker/default/user/login. I get the right page. Then (T('Login'), False, URL('default', 'user/login'), []), should work. Regards Johann --- 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. -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/pL9L2kgdGxA/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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: Default template file
the fact is that every view calls {{extend 'layout.html'}} explicitely. setting response.view (which can be done in models) won't fix that issue. you should go ahead and change all the {{extend}} statement to match your new base layout Il giorno mercoledì 12 giugno 2013 10:06:13 UTC+2, Domagoj Kovač ha scritto: Hi, I have a question. Currently there is a file views/layout.html, default view is possible to change with response.view = 'shared/entry_value_grid.html' is it possible to change default template view? -- --- 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: Default template file
Yes i see it now, i totally forgot about that :). -- --- 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] select list in auth.register()
I have a table holding nationalities and their IDs. I would like to use its rows in my register form to generate a drop down list, and on submit pass respective nationality ID to auth_user. Is there a way to implement a select list in the auth.register() form without using form.custom? Now I basically i call {{=register_form}} in my registration form. I'm not sure how to implement this in my controller, so there's a Nationality drop-down-list field in my view. -- --- 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] SQLFORM.grid run too many queries from database ...
I have a following table definition in my app. The table contains one filed that references another table called 'category' and then 3 fields that references auth_user table. task_type=db.define_table('scheduled_task_type', Field('category','reference category', label='Kategorie', requires=IS_IN_DB (db,db.category.id,'%(name)s')), Field('name', label='Název', requires=IS_NOT_EMPTY()), Field('description', 'text', label='Popis'), Field('period', label='Periodicita',requires=IS_IN_SET(PERIODICITA)), Field('start_date','date',label='Počáteční datum',requires=IS_DATE( format='%d.%m.%Y')), Field('responsible_1','reference auth_user', label='Odpovědná osoba',requires =IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_1_time','time',default='09:00', label='Reakční doba' ), Field('responsible_2','reference auth_user', label='Zástupce', requires= IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_2_time','time',default='10:00', label='Reakční doba' ), Field('responsible_3','reference auth_user', label='Osoba pro informování', requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_3_time','time',default='17:00', label='Reakční doba' ), ) Now when I use grid in controller like this: grid = SQLFORM.grid(db.scheduled_task_type.id0, fields=[task_type.category ,task_type.name,task_type.description]) ... I can see this huge set of database queries in response.toolbar() SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT count(*) FROM scheduled_task_type LEFT JOIN category ON ( scheduled_task_type.category = category.id) LEFT JOIN auth_user ON ( scheduled_task_type.responsible_1 = auth_user.id) WHERE (scheduled_task_type .id 0); 0.00ms SELECT scheduled_task_type.category, scheduled_task_type.name,scheduled_task_type .description, scheduled_task_type.id FROM scheduled_task_type LEFT JOIN category ON (scheduled_task_type.category = category.id) LEFT JOIN auth_user ON (scheduled_task_type.responsible_1 = auth_user.id) WHERE ( scheduled_task_type.id 0); 0.00ms SELECT category.id, category.name, category.description FROM category WHERE (category.id = 1) LIMIT 1 OFFSET 0; 0.00ms When I remove grid, this SQL queries disappears, so all are related to GRID component. What is this? Why so many redundant queries? Please help me understand how to optimise it ... -- --- 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: SQLFORM.grid run too many queries from database ...
All the reference fields generate queries in order to display the values from their referenced table instead of displaying the raw ID stored in the reference field itself. Separate queries are done for each row in the table, so this can get expensive. It would be more efficient to do a single query with joins to get all the data, but that is not how the grid works -- instead it just relies on the represent attribute of each field, which requires a query per field per record. Anthony On Wednesday, June 12, 2013 7:47:08 AM UTC-4, David Marko wrote: I have a following table definition in my app. The table contains one filed that references another table called 'category' and then 3 fields that references auth_user table. task_type=db.define_table('scheduled_task_type', Field('category','reference category', label='Kategorie', requires= IS_IN_DB(db,db.category.id,'%(name)s')), Field('name', label='Název', requires=IS_NOT_EMPTY()), Field('description', 'text', label='Popis'), Field('period', label='Periodicita',requires=IS_IN_SET(PERIODICITA)), Field('start_date','date',label='Počáteční datum',requires=IS_DATE( format='%d.%m.%Y')), Field('responsible_1','reference auth_user', label='Odpovědná osoba',requires =IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_1_time','time',default='09:00', label='Reakční doba'), Field('responsible_2','reference auth_user', label='Zástupce',requires =IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_2_time','time',default='10:00', label='Reakční doba'), Field('responsible_3','reference auth_user', label='Osoba pro informování', requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_3_time','time',default='17:00', label='Reakční doba'), ) Now when I use grid in controller like this: grid = SQLFORM.grid(db.scheduled_task_type.id0, fields=[task_type. category,task_type.name,task_type.description]) ... I can see this huge set of database queries in response.toolbar() SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT count(*) FROM scheduled_task_type LEFT JOIN category ON ( scheduled_task_type.category = category.id) LEFT JOIN auth_user ON ( scheduled_task_type.responsible_1 = auth_user.id) WHERE ( scheduled_task_type.id 0); 0.00ms SELECT scheduled_task_type.category, scheduled_task_type.name,scheduled_task_type .description, scheduled_task_type.id FROM scheduled_task_type LEFT JOIN category ON (scheduled_task_type.category = category.id) LEFT JOIN auth_user ON (scheduled_task_type.responsible_1 = auth_user.id) WHERE ( scheduled_task_type.id 0); 0.00ms SELECT category.id, category.name, category.description FROM category WHERE (category.id = 1) LIMIT 1 OFFSET 0; 0.00ms When I remove grid, this SQL queries disappears, so all are related to GRID component. What is this? Why so many redundant queries? Please help me understand how to optimise it ... -- --- 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: SQLFORM.grid run too many queries from database ...
I thought so but it is from table with one record only and one record reference category and three users. But I can see many queries to auth_user table with WHERE (auth_user.id IS NOT NULL) clause which is quite strange. Whats more, as you can see from my example I dont list user name columns at all in grid see fields=[task_type.category,task_type.name,task_type. description] Dne středa, 12. června 2013 14:08:46 UTC+2 Anthony napsal(a): All the reference fields generate queries in order to display the values from their referenced table instead of displaying the raw ID stored in the reference field itself. Separate queries are done for each row in the table, so this can get expensive. It would be more efficient to do a single query with joins to get all the data, but that is not how the grid works -- instead it just relies on the represent attribute of each field, which requires a query per field per record. Anthony On Wednesday, June 12, 2013 7:47:08 AM UTC-4, David Marko wrote: I have a following table definition in my app. The table contains one filed that references another table called 'category' and then 3 fields that references auth_user table. task_type=db.define_table('scheduled_task_type', Field('category','reference category', label='Kategorie', requires= IS_IN_DB(db,db.category.id,'%(name)s')), Field('name', label='Název', requires=IS_NOT_EMPTY()), Field('description', 'text', label='Popis'), Field('period', label='Periodicita',requires=IS_IN_SET(PERIODICITA)), Field('start_date','date',label='Počáteční datum',requires=IS_DATE( format='%d.%m.%Y')), Field('responsible_1','reference auth_user', label='Odpovědná osoba',requires =IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_1_time','time',default='09:00', label='Reakční doba'), Field('responsible_2','reference auth_user', label='Zástupce',requires =IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_2_time','time',default='10:00', label='Reakční doba'), Field('responsible_3','reference auth_user', label='Osoba pro informování', requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_3_time','time',default='17:00', label='Reakční doba'), ) Now when I use grid in controller like this: grid = SQLFORM.grid(db.scheduled_task_type.id0, fields=[task_type. category,task_type.name,task_type.description]) ... I can see this huge set of database queries in response.toolbar() SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT count(*) FROM scheduled_task_type LEFT JOIN category ON ( scheduled_task_type.category = category.id) LEFT JOIN auth_user ON ( scheduled_task_type.responsible_1 = auth_user.id) WHERE ( scheduled_task_type.id 0); 0.00ms SELECT scheduled_task_type.category, scheduled_task_type.name,scheduled_task_type .description, scheduled_task_type.id FROM scheduled_task_type LEFT JOIN category ON (scheduled_task_type.category = category.id) LEFT JOIN auth_user ON (scheduled_task_type.responsible_1 = auth_user.id) WHERE ( scheduled_task_type.id 0); 0.00ms SELECT category.id, category.name, category.description FROM category WHERE (category.id = 1) LIMIT 1 OFFSET 0; 0.00ms When I remove grid, this SQL queries disappears, so all are related to GRID component. What is this?
[web2py] Re: smartgrid breadcrumbs
Something like db.sometable.id.represent lambda value, row: db.sometable[value].name Or def get_office_name(id) return db((db.relationtable.sometable_id==id) (db.relationtable.othertable_id==db.othertable.id)).select( db.othertable.name).first().name db.sometable.id.represent lambda value, row: get_office_name(value) On Wednesday, June 12, 2013 4:21:05 AM UTC-4, CrC Nommack wrote: Hello, sorry to bother you guys but I can figure it out how I can solve this problem. I have the following tables: db.define_table('t_unit', Field('f_unit', type='string', label=T('Unit')), auth.signature, format='%(f_unit)s', singular=Unit, migrate=settings.migrate) db.define_table('t_offices', Field('f_office', type='string', label=T('Office number')), auth.signature, singular=Office, format='%(f_office)s', migrate=settings.migrate) db.define_table('t_unit_offices', Field('f_unit', 'reference t_unit', label=T('Unit')), Field('f_office', 'reference t_offices', label=T('Office')), auth.signature, singular=Office, format= '%(f_office)s', migrate=settings.migrate) Is a many to many relationship. One unit can have many offices and one office can be shared by more than one unit. I'm displaying it with a smartgrid: assets = SQLFORM.smartgrid(db.t_unit, linked_tables=['t_unit_offices'], csv = False, deletable = True, editable = True, create = True, paginate=100 ) That works well. But now I need to have the following relationship: one specific office in one unit have many computers (1:n) I created the following table: db.define_table('t_computers', Field('f_office', 'reference t_unit_offices', label=T('Office')), Field('f_inv_nr', type='string', label=T('Inventory number')), Field('f_stag', type='string', label=T('ST')), auth.signature, format='%(f_inv_nr)s', singular=Computer, plural=Computers, migrate=settings.migrate) and modified the smartgrid definition like that: assets = SQLFORM.smartgrid(db.t_unit, linked_tables=['t_unit_offices', 't_computers'], csv = False, deletable = True, editable = True, create = True, paginate=100 ) It works well but when I click in the Hardwares link it shows the following in the breadcrumbs: UnitsA1Offices*8*Hardware How can I manage to get the name of the office instead of the id? Thank you very much for all. Kind regards. -- --- 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] Multiple files upload
Hi, I have a question. I want to enable multiple files upload. I will not be using any jQuery/ajax script. I am using HTML5 multiple attribute on my input field, and then. Html 5 File API just for displaying files below my form. $(.upload).change(function(evt) { var button = $(this); var files = evt.target.files; button.next(ul.new).remove(); var output = []; for (var i = 0, f; f = files[i]; i++) { output.push('listrong', f.name, '/li'); } button.after('ul class=files new' + output.join('') + '/ul'); }) In my form i want to have a field names attachment[] instead of attachment, so i can receive multiple files. When i add [] to my file input name i receive an error: type 'exceptions.SyntaxError' invalid table or field name: attachment[] If i try to upload multiple files without changing the name, i receive an error: type 'exceptions.UnboundLocalError' local variable 'source_file' referenced before assignment How could i do this? -- --- 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] Multiple files upload
Did you check the contents of request.vars.attachment when you upload multiple files at once? It should be a list already. attachment[] is not a python syntax which you may have noticed from the SyntaxError exception. Something is wrong in your code (second exception), not related to the upload issue. On Wed, Jun 12, 2013 at 3:01 PM, Domagoj Kovač doctorko...@gmail.comwrote: Hi, I have a question. I want to enable multiple files upload. I will not be using any jQuery/ajax script. I am using HTML5 multiple attribute on my input field, and then. Html 5 File API just for displaying files below my form. $(.upload).change(function(evt) { var button = $(this); var files = evt.target.files; button.next(ul.new).remove(); var output = []; for (var i = 0, f; f = files[i]; i++) { output.push('listrong', f.name, '/li'); } button.after('ul class=files new' + output.join('') + '/ul'); }) In my form i want to have a field names attachment[] instead of attachment, so i can receive multiple files. When i add [] to my file input name i receive an error: type 'exceptions.SyntaxError' invalid table or field name: attachment[] If i try to upload multiple files without changing the name, i receive an error: type 'exceptions.UnboundLocalError' local variable 'source_file' referenced before assignment How could i do this? -- --- 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. -- --- 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: admin access password file
In the URL, are you using http or https? Assuming you use apache, can you show the config file? On Wednesday, 12 June 2013 01:53:25 UTC-5, Paolo valleri wrote: Hi all, I have to migrate a web2py app to a centos server. It has python 2.6.6, uwsgi 1.9.12. admin fails saying: admin disabled because unable to access password file the file (parameters_443.py) is there. I tried to debug the failure and I discover that, despite the fact that I use https, it tries to access parameters_80.py. Thus, I created the file parameters_80.py but then it fails saying to use https :(. Paolo -- --- 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: SQLFORM.grid run too many queries from database ...
Are you sure they are coming form the grid and not from other part of the code? The grid should not do any query that does not specify an ID or a LIMITBY. On Wednesday, 12 June 2013 07:18:59 UTC-5, David Marko wrote: I thought so but it is from table with one record only and one record reference category and three users. But I can see many queries to auth_user table with WHERE (auth_user.id IS NOT NULL) clause which is quite strange. Whats more, as you can see from my example I dont list user name columns at all in grid see fields=[task_type.category,task_type.name, task_type.description] Dne středa, 12. června 2013 14:08:46 UTC+2 Anthony napsal(a): All the reference fields generate queries in order to display the values from their referenced table instead of displaying the raw ID stored in the reference field itself. Separate queries are done for each row in the table, so this can get expensive. It would be more efficient to do a single query with joins to get all the data, but that is not how the grid works -- instead it just relies on the represent attribute of each field, which requires a query per field per record. Anthony On Wednesday, June 12, 2013 7:47:08 AM UTC-4, David Marko wrote: I have a following table definition in my app. The table contains one filed that references another table called 'category' and then 3 fields that references auth_user table. task_type=db.define_table('scheduled_task_type', Field('category','reference category', label='Kategorie', requires= IS_IN_DB(db,db.category.id,'%(name)s')), Field('name', label='Název', requires=IS_NOT_EMPTY()), Field('description', 'text', label='Popis'), Field('period', label='Periodicita',requires=IS_IN_SET(PERIODICITA )), Field('start_date','date',label='Počáteční datum',requires=IS_DATE( format='%d.%m.%Y')), Field('responsible_1','reference auth_user', label='Odpovědná osoba' , requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_1_time','time',default='09:00', label='Reakční doba'), Field('responsible_2','reference auth_user', label='Zástupce',requires =IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_2_time','time',default='10:00', label='Reakční doba'), Field('responsible_3','reference auth_user', label='Osoba pro informování', requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_3_time','time',default='17:00', label='Reakční doba'), ) Now when I use grid in controller like this: grid = SQLFORM.grid(db.scheduled_task_type.id0, fields=[task_type. category,task_type.name,task_type.description]) ... I can see this huge set of database queries in response.toolbar() SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT count(*) FROM scheduled_task_type LEFT JOIN category ON ( scheduled_task_type.category = category.id) LEFT JOIN auth_user ON ( scheduled_task_type.responsible_1 = auth_user.id) WHERE ( scheduled_task_type.id 0); 0.00ms SELECT scheduled_task_type.category, scheduled_task_type.name,scheduled_task_type .description, scheduled_task_type.id FROM scheduled_task_type LEFT JOIN category ON (scheduled_task_type.category = category.id) LEFT JOIN auth_user ON (scheduled_task_type.responsible_1 = auth_user.id) WHERE ( scheduled_task_type.id 0); 0.00ms
Re: [web2py] Multiple files upload
I have a filed: field = Field(field_name, upload, requires=IS_NOT_EMPTY(), uploadfolder=os.path.join(request.folder , 'uploads'), label=LABEL(field_description, _for= input_id)) Does this have anything to do with the second error? From error i can assume that web2py is trying to upload the file itself, but when i select multiple files list is sent and there is the problem, i assume. -- --- 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: smartgrid breadcrumbs
On Wednesday, June 12, 2013 4:21:05 AM UTC-4, CrC Nommack wrote: Hello, sorry to bother you guys but I can figure it out how I can solve this problem. I have the following tables: db.define_table('t_unit', Field('f_unit', type='string', label=T('Unit')), auth.signature, format='%(f_unit)s', singular=Unit, migrate=settings.migrate) db.define_table('t_offices', Field('f_office', type='string', label=T('Office number')), auth.signature, singular=Office, format='%(f_office)s', migrate=settings.migrate) db.define_table('t_unit_offices', Field('f_unit', 'reference t_unit', label=T('Unit')), Field('f_office', 'reference t_offices', label=T('Office')), auth.signature, singular=Office, format= '%(f_office)s', migrate=settings.migrate) Above, instead of format='%(f_office)s', maybe: format=lambda r: db.t_offices(r.f_office).f_office Anthony -- --- 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: smartgrid breadcrumbs
Thank you very much Anthony! It works! Kind regards On Wednesday, June 12, 2013 3:24:19 PM UTC+2, Anthony wrote: db.define_table('t_unit_offices', Field('f_unit', 'reference t_unit', label=T('Unit')), Field('f_office', 'reference t_offices', label=T('Office')), auth.signature, singular=Office, format= '%(f_office)s', migrate=settings.migrate) Above, instead of format='%(f_office)s', maybe: format=lambda r: db.t_offices(r.f_office).f_office Anthony -- --- 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: smartgrid breadcrumbs
Thank you for the reply. I couldn't make it like you proposed anyway Anthony's answer worked. Once again thank you. On Wednesday, June 12, 2013 2:28:01 PM UTC+2, Cliff Kachinske wrote: Something like db.sometable.id.represent lambda value, row: db.sometable[value].name Or def get_office_name(id) return db((db.relationtable.sometable_id==id) (db.relationtable.othertable_id==db.othertable.id)).select( db.othertable.name).first().name db.sometable.id.represent lambda value, row: get_office_name(value) On Wednesday, June 12, 2013 4:21:05 AM UTC-4, CrC Nommack wrote: Hello, sorry to bother you guys but I can figure it out how I can solve this problem. I have the following tables: db.define_table('t_unit', Field('f_unit', type='string', label=T('Unit')), auth.signature, format='%(f_unit)s', singular=Unit, migrate=settings.migrate) db.define_table('t_offices', Field('f_office', type='string', label=T('Office number')), auth.signature, singular=Office, format='%(f_office)s', migrate=settings.migrate) db.define_table('t_unit_offices', Field('f_unit', 'reference t_unit', label=T('Unit')), Field('f_office', 'reference t_offices', label=T('Office')), auth.signature, singular=Office, format= '%(f_office)s', migrate=settings.migrate) Is a many to many relationship. One unit can have many offices and one office can be shared by more than one unit. I'm displaying it with a smartgrid: assets = SQLFORM.smartgrid(db.t_unit, linked_tables=['t_unit_offices'], csv = False, deletable = True, editable = True, create = True, paginate=100 ) That works well. But now I need to have the following relationship: one specific office in one unit have many computers (1:n) I created the following table: db.define_table('t_computers', Field('f_office', 'reference t_unit_offices', label=T('Office')), Field('f_inv_nr', type='string', label=T('Inventory number')), Field('f_stag', type='string', label=T('ST')), auth.signature, format='%(f_inv_nr)s', singular=Computer, plural=Computers, migrate=settings.migrate) and modified the smartgrid definition like that: assets = SQLFORM.smartgrid(db.t_unit, linked_tables=['t_unit_offices', 't_computers'], csv = False, deletable = True, editable = True, create = True, paginate=100 ) It works well but when I click in the Hardwares link it shows the following in the breadcrumbs: UnitsA1Offices*8*Hardware How can I manage to get the name of the office instead of the id? Thank you very much for all. Kind regards. -- --- 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] response time impacted by compileapp
Hi, We use web2py somewhat differently than most use cases in that we aren't using a database at all, but instead back our web2py app with connections to a server over a local unix RPC socket. We still use web2py to perform validations, and UI generation, so we have a bunch of models that basically contain gluon Field's, and then either call SQLFORM on that model's fields or serialize that model and send it over the wire. More specifically, we have a number of controllers that correspond to a model (controllers/foo.py, and a model/foo.py that we can call SQLFORM on to generate a form), and then we have a single rest.py controller that provides a rest interface to the rpc socket (rest.py basically mirrors all of the controllers with methods defined as: @request.restful(), validates the data using the correct model, and communicates over the rpc socket) I've been doing a number of benchmarks recently, and found that while it generally takes ~3.5ms to receive a response over the unix domain socket, calls to the web2py rest controller are taking somewhere around ~80-90ms to return. My suspicion is that this is because web2py is compiling all of the models for every request (running web2py with the profiler seems to corroborate this, indicating that most of the time spent in the response is in compileapp). From my reading it also seems that we can reduce the compilation time of compileapp by using conditional models, however the rest.py controller potentially uses all of them given which method is called in the controller. There also seems to be an undocumented response.models_to_run method that I'm not sure I understand fully. What would be the best way to reduce the response time of this rest.py controller? Can I put response.models_to_run inside each of the controller methods in rest.py, to ensure that only the models we need for the operation are compiled? Am I off track here, and the model compilation is not the source of latency? -- --- 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] table for editing referenced objects
suppose I have the following table: db.define_table('product', Field('name', 'string'), Field('price', 'integer'), ...) and other tables referencing the product, e.g. db.define_table('product_value', Field('product', db.product), Field('value', 'integer')) now I want a page where I can see and edit all details of the product (price, etc.). Further there should be a list of all product_values of this product. This list should be a table where I can directly edit all values and also add new rows. When I submit the product page I want all input values to be validated and saved (this means also deleting or creating product_value entries). Currently I'm doing this manually which is quite time consuming. In the controller I have to create all input controls for the product values (and set name/id of input fields to 'product_value_id' so I can identify them later on), when the form is submitted I have to validate all input fields and then find out which rows of the product_value were deleted, added or edited. I'm wondering if there is an easier way in web2py to do this? is it possible to achieve this with SQLFORM.grid? I want in-place edit for the product values and only perform db operations when the whole product page is submitted. Seperate view or edit buttons as shown in the documentation screenshots are not needed. Alex -- --- 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: admin access password file
Hi Massimo, I used https. I expired the same behavior on both apache and nginx. please find attached the condiguration file of nginx Paolo 2013/6/12 Massimo Di Pierro massimo.dipie...@gmail.com In the URL, are you using http or https? Assuming you use apache, can you show the config file? On Wednesday, 12 June 2013 01:53:25 UTC-5, Paolo valleri wrote: Hi all, I have to migrate a web2py app to a centos server. It has python 2.6.6, uwsgi 1.9.12. admin fails saying: admin disabled because unable to access password file the file (parameters_443.py) is there. I tried to debug the failure and I discover that, despite the fact that I use https, it tries to access parameters_80.py. Thus, I created the file parameters_80.py but then it fails saying to use https :(. Paolo -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/1PDpL5yRKMs/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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. ds.integreen-life.bz.it.conf Description: Binary data
[web2py] Re: SQLFORM.grid run too many queries from database ...
Its grid doing this definitely. Removing the grid and all queries disapear. I also have had one left join in grid definition, which causes some additional queries to auth_user database. I have striped my code to simplest one, now when fetching one record from my database, I'm getting queries as below: a) query to category table, my record reference category table b) 3 queries to auth_table, but I dont have any username column in grid and also see the strange where clause ... c) count quersy, chis is fine d) the main query itself, which is fine Strange are the queries to category and auth_user tables(the first 4 queries), particulary the where clause which is just checking id 'IS NOT NULL'. I don't use represent for this fields, so in category column I can see ID instead of name. When I add represent to this category Field, additional query appears like this one, which fetches that category name for this particular category id, which is fine. SELECT category.id, category.name, category.description FROM category WHERE (category.id = 1) LIMIT 1 OFFSET 0; SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT count(*) FROM scheduled_task_type WHERE (scheduled_task_type.id 0); 0.00ms SELECT scheduled_task_type.category, scheduled_task_type.name,scheduled_task_type .description, scheduled_task_type.id FROM scheduled_task_type WHERE ( scheduled_task_type.id 0) ORDER BY scheduled_task_type.id LIMIT 1 OFFSET 0 ; -- --- 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: SQLFORM.grid run too many queries from database ...
Sorry, didn't look to closely at the queries. In this case, most of those queries are for the search widget. The default search widget includes dropdowns for all the reference fields that have requires attributes with IS_IN_DB validators -- the IS NOT NULL queries for db.category and db.auth_user are for populating those dropdowns. If you don't want that, in the call to .grid(), you can set searchable=False, or you can specify search_widget=[your custom widget] (or you can temporarily set the requires attributes of the reference fields to None). I'm not sure why each of those queries appears three times, though -- are there multiple calls to .grid() in the request? Also, is that your exact .grid() call? I see left joins in the queries, but you don't have a left argument in your .grid() call. Anthony On Wednesday, June 12, 2013 8:18:59 AM UTC-4, David Marko wrote: I thought so but it is from table with one record only and one record reference category and three users. But I can see many queries to auth_user table with WHERE (auth_user.id IS NOT NULL) clause which is quite strange. Whats more, as you can see from my example I dont list user name columns at all in grid see fields=[task_type.category,task_type.name, task_type.description] Dne středa, 12. června 2013 14:08:46 UTC+2 Anthony napsal(a): All the reference fields generate queries in order to display the values from their referenced table instead of displaying the raw ID stored in the reference field itself. Separate queries are done for each row in the table, so this can get expensive. It would be more efficient to do a single query with joins to get all the data, but that is not how the grid works -- instead it just relies on the represent attribute of each field, which requires a query per field per record. Anthony On Wednesday, June 12, 2013 7:47:08 AM UTC-4, David Marko wrote: I have a following table definition in my app. The table contains one filed that references another table called 'category' and then 3 fields that references auth_user table. task_type=db.define_table('scheduled_task_type', Field('category','reference category', label='Kategorie', requires= IS_IN_DB(db,db.category.id,'%(name)s')), Field('name', label='Název', requires=IS_NOT_EMPTY()), Field('description', 'text', label='Popis'), Field('period', label='Periodicita',requires=IS_IN_SET(PERIODICITA )), Field('start_date','date',label='Počáteční datum',requires=IS_DATE( format='%d.%m.%Y')), Field('responsible_1','reference auth_user', label='Odpovědná osoba' , requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_1_time','time',default='09:00', label='Reakční doba'), Field('responsible_2','reference auth_user', label='Zástupce',requires =IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_2_time','time',default='10:00', label='Reakční doba'), Field('responsible_3','reference auth_user', label='Osoba pro informování', requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_3_time','time',default='17:00', label='Reakční doba'), ) Now when I use grid in controller like this: grid = SQLFORM.grid(db.scheduled_task_type.id0, fields=[task_type. category,task_type.name,task_type.description]) ... I can see this huge set of database queries in response.toolbar() SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE (auth_user .id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM
[web2py] Re: user text contains semi-colons
The answer was to pass the data as JSON in an ajax call rather than add parameters to an URL. On Thursday, 6 June 2013 16:37:05 UTC+1, Carl wrote: I've a browser app that calls a Web2py server app; it builds up URLs to pass data. Some of that data might be from an end-user and if that data contains a semi-colon it breaks web2py's parsing of the URL into args and vars (specifically it breaks the vars parsing) Q1. Any suggestions of the best approach to working around this? I'm already escape user input. The only solution I can think of is to parse out the semi-colons from the user content before calling the Web2py server. Q2. Are there other characters in an URL that can break web2py? Bcakground: Web2py is running on GAE. -- --- 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: SQLFORM.grid run too many queries from database ...
Thanks Anthony, searchable=False did the trick and removed the first 4 queries. Things got clear for me now ... Dne středa, 12. června 2013 16:17:11 UTC+2 Anthony napsal(a): Sorry, didn't look to closely at the queries. In this case, most of those queries are for the search widget. The default search widget includes dropdowns for all the reference fields that have requires attributes with IS_IN_DB validators -- the IS NOT NULL queries for db.category and db.auth_user are for populating those dropdowns. If you don't want that, in the call to .grid(), you can set searchable=False, or you can specify search_widget=[your custom widget] (or you can temporarily set the requires attributes of the reference fields to None). I'm not sure why each of those queries appears three times, though -- are there multiple calls to .grid() in the request? Also, is that your exact .grid() call? I see left joins in the queries, but you don't have a left argument in your .grid() call. Anthony On Wednesday, June 12, 2013 8:18:59 AM UTC-4, David Marko wrote: I thought so but it is from table with one record only and one record reference category and three users. But I can see many queries to auth_user table with WHERE (auth_user.id IS NOT NULL) clause which is quite strange. Whats more, as you can see from my example I dont list user name columns at all in grid see fields=[task_type.category,task_type.name, task_type.description] Dne středa, 12. června 2013 14:08:46 UTC+2 Anthony napsal(a): All the reference fields generate queries in order to display the values from their referenced table instead of displaying the raw ID stored in the reference field itself. Separate queries are done for each row in the table, so this can get expensive. It would be more efficient to do a single query with joins to get all the data, but that is not how the grid works -- instead it just relies on the represent attribute of each field, which requires a query per field per record. Anthony On Wednesday, June 12, 2013 7:47:08 AM UTC-4, David Marko wrote: I have a following table definition in my app. The table contains one filed that references another table called 'category' and then 3 fields that references auth_user table. task_type=db.define_table('scheduled_task_type', Field('category','reference category', label='Kategorie', requires= IS_IN_DB(db,db.category.id,'%(name)s')), Field('name', label='Název', requires=IS_NOT_EMPTY()), Field('description', 'text', label='Popis'), Field('period', label='Periodicita',requires=IS_IN_SET(PERIODICITA )), Field('start_date','date',label='Počáteční datum',requires=IS_DATE( format='%d.%m.%Y')), Field('responsible_1','reference auth_user', label='Odpovědná osoba', requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_1_time','time',default='09:00', label='Reakční doba'), Field('responsible_2','reference auth_user', label='Zástupce',requires =IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_2_time','time',default='10:00', label='Reakční doba'), Field('responsible_3','reference auth_user', label='Osoba pro informování', requires=IS_IN_DB(db,db.auth_user.id,'%(username)s')), Field('responsible_3_time','time',default='17:00', label='Reakční doba'), ) Now when I use grid in controller like this: grid = SQLFORM.grid(db.scheduled_task_type.id0, fields=[task_type. category,task_type.name,task_type.description]) ... I can see this huge set of database queries in response.toolbar() SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE ( auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 1.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE ( auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE ( auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE ( auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE ( auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE ( auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id; 0.00ms SELECT category.name, category.id FROM category WHERE (category.id IS NOT NULL) ORDER BY category.name, category.id; 0.00ms SELECT auth_user.username, auth_user.id FROM auth_user WHERE ( auth_user.id IS NOT NULL) ORDER BY auth_user.username, auth_user.id;
[web2py] Re: response time impacted by compileapp
given that you can pre-compile your app, did you test if the compilation time drops before moving around your models to use conditional ones ? On Wednesday, June 12, 2013 3:47:47 PM UTC+2, Matt wrote: Hi, We use web2py somewhat differently than most use cases in that we aren't using a database at all, but instead back our web2py app with connections to a server over a local unix RPC socket. We still use web2py to perform validations, and UI generation, so we have a bunch of models that basically contain gluon Field's, and then either call SQLFORM on that model's fields or serialize that model and send it over the wire. More specifically, we have a number of controllers that correspond to a model (controllers/foo.py, and a model/foo.py that we can call SQLFORM on to generate a form), and then we have a single rest.py controller that provides a rest interface to the rpc socket (rest.py basically mirrors all of the controllers with methods defined as: @request.restful(), validates the data using the correct model, and communicates over the rpc socket) I've been doing a number of benchmarks recently, and found that while it generally takes ~3.5ms to receive a response over the unix domain socket, calls to the web2py rest controller are taking somewhere around ~80-90ms to return. My suspicion is that this is because web2py is compiling all of the models for every request (running web2py with the profiler seems to corroborate this, indicating that most of the time spent in the response is in compileapp). From my reading it also seems that we can reduce the compilation time of compileapp by using conditional models, however the rest.py controller potentially uses all of them given which method is called in the controller. There also seems to be an undocumented response.models_to_run method that I'm not sure I understand fully. What would be the best way to reduce the response time of this rest.py controller? Can I put response.models_to_run inside each of the controller methods in rest.py, to ensure that only the models we need for the operation are compiled? Am I off track here, and the model compilation is not the source of latency? -- --- 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] Multiple files upload
web2py has no notion of an array of uploads. Each form must upload one file (per upload field) only, if you want to leverage the automatic behaviour of web2py forms. On Wednesday, June 12, 2013 3:22:12 PM UTC+2, Domagoj Kovač wrote: I have a field: field = Field(field_name, upload, requires=IS_NOT_EMPTY(), uploadfolder=os.path.join(request. folder, 'uploads'), label=LABEL(field_description, _for= input_id)) Does this have anything to do with the second error? From error i can assume that web2py is trying to upload the file itself, but when i select multiple files list is sent and there is the problem, i assume. -- --- 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: response time impacted by compileapp
response.models_to_run can't go in a controller because the controller isn't called until after models have been run. If you don't know which models you will need until you get to the controller, you can put model definitions into modules and import and run them when needed. Anthony On Wednesday, June 12, 2013 9:47:47 AM UTC-4, Matt wrote: Hi, We use web2py somewhat differently than most use cases in that we aren't using a database at all, but instead back our web2py app with connections to a server over a local unix RPC socket. We still use web2py to perform validations, and UI generation, so we have a bunch of models that basically contain gluon Field's, and then either call SQLFORM on that model's fields or serialize that model and send it over the wire. More specifically, we have a number of controllers that correspond to a model (controllers/foo.py, and a model/foo.py that we can call SQLFORM on to generate a form), and then we have a single rest.py controller that provides a rest interface to the rpc socket (rest.py basically mirrors all of the controllers with methods defined as: @request.restful(), validates the data using the correct model, and communicates over the rpc socket) I've been doing a number of benchmarks recently, and found that while it generally takes ~3.5ms to receive a response over the unix domain socket, calls to the web2py rest controller are taking somewhere around ~80-90ms to return. My suspicion is that this is because web2py is compiling all of the models for every request (running web2py with the profiler seems to corroborate this, indicating that most of the time spent in the response is in compileapp). From my reading it also seems that we can reduce the compilation time of compileapp by using conditional models, however the rest.py controller potentially uses all of them given which method is called in the controller. There also seems to be an undocumented response.models_to_run method that I'm not sure I understand fully. What would be the best way to reduce the response time of this rest.py controller? Can I put response.models_to_run inside each of the controller methods in rest.py, to ensure that only the models we need for the operation are compiled? Am I off track here, and the model compilation is not the source of latency? -- --- 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] Checkboxs appearing but not the values
I am new to web2py but awed with its awesomeness. I tried out the following in the view : {{extend 'layout.html'}} h1Testing checkboxes/h1 {{for i,v in zip(range(3),['a','b','c']):}} {{=INPUT(_type='checkbox', _value=v, _name='cb' + str(i))}} {{pass}} The 3 checkboxes show up but not the 'a', 'b' or 'c' Am I doing something wrong? -- --- 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: Checkboxs appearing but not the values
The HTML input element for checkboxes only displays the actual checkbox -- if you want a label, you have to explicitly include that in the HTML (typically via the label element). Anthony On Wednesday, June 12, 2013 12:12:12 PM UTC-4, alokjoshiofaarmax wrote: I am new to web2py but awed with its awesomeness. I tried out the following in the view : {{extend 'layout.html'}} h1Testing checkboxes/h1 {{for i,v in zip(range(3),['a','b','c']):}} {{=INPUT(_type='checkbox', _value=v, _name='cb' + str(i))}} {{pass}} The 3 checkboxes show up but not the 'a', 'b' or 'c' Am I doing something wrong? -- --- 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] Raspberry Pi GPIO home automation by willq44 - Customization
Just a small video http://www.youtube.com/watch?v=c1tfKEM_9Eg 2013/6/10 António Ramos ramstei...@gmail.com The woden box its one piece only with a hole to fix the arduino nano and the rfid reader. A friend made it. I asked him to make another one. I need 2 boxes, one to be used in the entrance of our company, so users can pass the card to enter. The other to be used by our security dept to issue cards to new users. They take the foto of the user , then read the tag from the tag directly from the web page, directly to the rfid tag field. All web, all web2py. 2013/6/10 Massimo Di Pierro massimo.dipie...@gmail.com Yes the wooden box is fantastic! On Monday, 10 June 2013 13:51:06 UTC-5, freäk qnc wrote: Very interesting indeed! I'd love to read your blog/tutorial or watch your video on this project. Very interesting one... btw I love the wooden box for the RFID. Keep up the great work Antonio! Cheers! :) On Jun 10, 2013, at 10:46 AM, António Ramos wrote: I´m working on putting here some screenshots or a video showing it. So far My arduino hardware... https://www.dropbox.com/s/**rii867stp80pp5z/2013-05-09%**2011.15.07.jpghttps://www.dropbox.com/s/rii867stp80pp5z/2013-05-09%2011.15.07.jpg https://www.dropbox.com/s/**0vpsfluq3z0kub4/2013-05-09%**2012.17.46.jpghttps://www.dropbox.com/s/0vpsfluq3z0kub4/2013-05-09%2012.17.46.jpg I use: fullcalendar pypdf for the printing cards on the rfid card D3js Filepicker.io, allows to take pictures to workers from the browser page!!! Tornado messaging websockets Coffeescript and of course *WEB2PY* I lied, its not under 20 lines of nodejs . Its about 53 lines. Yet, in python i would need some more 2013/6/10 Massimo Di Pierro massimo@gmail.com Tell us more. Have some pictures or screenshots? On Monday, 10 June 2013 05:21:50 UTC-5, Ramos wrote: I' not spanishhh. Portuguese from Portugal. I have a web2py app to control all outside workers via an RFID reader. I use arduino to read the card and send it via serial. Then in the local PC I have nodejs to read it and call a web2py service that via tornado sockets updates a web page. My web2py app is in the amazon cloud. It works so fast just under 20 lines of nodejs.amazing! No dia Segunda-feira, 10 de Junho de 2013, freakqnc@gmail.comfreakqnc@ gmail.com http://gmail.com/ escreveu: Thanks Jason and Antonio for your help. Jason, thanks for the additional tips and info. You are right is not web2py related, it's just python related when it comes to having the GPIO working, then again anything assembled with web2py is related to it... the GPIO file contains that while loop you talked about and that's what is necessary to have an event listener as mentioned earlier. Again if not replicating that project we'll continue to have a failure to communicate, so I agree, it's best we leave it at that as I've also already dropped web2py althogether since it won't do for me and many who like me are looking for an implementation that would work with more simplicity. So I'l off to other option, but I thank you again for your time and help Jason. About NodeJS, I believe you might be incorrect. Is not as new as you think and is already being heavily used for commercial and critical use already... one company making use of it for instance, is Google, as I've been told directly by a Google employee I know. Anyway I am really glad Antonio passed along the info... first of all I love to see more technologies reaching the pi world and empowering the pi platform, and also because coincidentally I've started to get into nodejs since a short while so that'll be a great learning project from me. Muchisimas gracias por el enlace Antonio! :) Cheers! ;D On Jun 10, 2013, at 4:21 AM, Jason (spot) Brower wrote: Sounds interesting. Personally my system ran with very little cpu at all. There are way to make it run effeciently. Node is a fun new technology, but I personally don't trust it for commercial use yet. It's still at that young and fragmenting stage so the technology could change to fast. :) Have fun and it would be great to see what you do with the pi. BR, Jason On Mon, Jun 10, 2013 at 10:54 AM, António Ramos ramstei...@gmail.com wrote: Sorry to disappoint you but raspberry pi go a lot better with nodejs javascrcipt framework.Almost no CPU usage check this http://pijs.io/ 2013/6/10 Jason (spot) Brower encomp...@gmail.com HI, I'm not totally sure what the gpio file is about, but an easy way to do it is to have while loop in a python file. Each time it goes through the loop it can do things like check the serial line for sensor data, run any automated items like turning on the lights in the evening, and read for messages that where sent to the server from the internal network. I used ampy back in the day: https://launchpad.net/**amp**yhttps://launchpad.net/ampywith that system
[web2py] serverlet with jsessionid
A web2py function calls a java serverlet. This serverlet calls back my web2py application and uses an url like http://mydomain/app/contr/anotherfunction*;jsessionid=1.2.3.4.abcd* ?var1=1var2=2 The part *;jsessionid=1.2.3.4.abcd* produces an invalid request. I cannot change the (foreign) serverlet. Is there any way to ignore the jsessionid-part? -- Regards Martin -- --- 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] Dependency issue with gluino
I easy_install-ed gluino, but upon importing it, I get an ImportError: No module named contrib.pbkdf2. Can someone tell me what I need to take care of the dependency? Thanks. -- --- 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 use shell with GAE dev server
Hello, I'm trying to use the interactive shell with the GAE dev server on Windows. Wahet do i need to do to getthis working? I'm now getting this error 5 times: web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.4.7-stable+timestamp.2013.05.24.17.48.47 Database drivers available: SQLite(sqlite3), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), CouchDB(couchdb), IMAP(imaplib) DEBUG: connect attempt 0, connection error: Traceback (most recent call last): File C:\Users\*\gluon\dal.py, line 7429, in __init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File *\gluon\dal.py, line 2220, in __init__ if do_connect: self.reconnect() File C:\Users\*\gluon\dal.py, line 603, in reconnect self.connection = f() File C:\Users\*\gluon\dal.py, line 2218, in connector return self.driver.Connection(dbpath, **driver_args) OperationalError: unable to open database file I'v tried adding this folder to my PATH with the GAE modules. PATH=%PATH%;C:\Program Files (x86)\Google\google_appengine\google\appengine\ext Thanks! -- --- 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] Models - graph model, How to change 'Undefined' to chosen title?
Hi - I am a new web2py and graphviz user who finds the 'graph model' graphic generation to be invaluable. It isn't apparent how, or if, it is possible to specify the title text for the generated graphic, however. I always see 'Undefined'. I can save as a .dot file, manually edit it, and redisplay with graphviz, but I figure there is some simple way I have not found to specify the test in db.py (most likely). Anyone know how? - Michael -- --- 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] SQLFROM.smartgrid in GAE, query not supported
Hi, I have deployed a *SQLFORM.smartgrid* very simple book's example: *db.define_table('t_parent',Field('name'),format='%(name)s') db.define_table('child',Field('name'),Field('f_parent','reference t_parent'))* Controller *@auth.requires_login() def index(): db.child.f_parent.writable = False grid = SQLFORM.smartgrid(db.t_parent,linked_tables=['child'],create=True, editable=dict(t_parent=True,child=True)) return dict(grid=grid)* In view: *{{=grid}}* It works fine in localhost, works fine in pythonanywhere ( http://jparga.pythonanywhere.com/borrame/default/indexhttp://jparga.pythonanywhere.com/borrame/default/user/login?_next=/borrame/default/index ) BUT ,in* GAE *it doesn't work and dysplay the following message:* Query Not Supported: invalid filter: __key__ filter value must be a Key; received None (a NoneType)* (http://web2gae.appspot.com/borrame/default/index/) I have tried adding several requirements to db.child.f_parent, like IS_NOT_EMPTY, a default value and so on but it did'n work. Thanks for your help. -- --- 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] Stream WAV file from existing database
Hi, I am trying to stream a audio file (WAV) that is contained within a MySQL database. From doing some searching on the web to get around the audio content not being encoded base64 in the database I have the field defined in db.py as follows: Field('audio',type=SQLCustomType(type='string', native='blob')), Thanks in advance, Todd -- --- 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 Grid: Hiding from the main grid but show on other views
Hi Massimo. Perhaps I explained this incorrectly. When I added db.CodeMaster.Code_Example.readable = False that did two things: a) Removed the Code_Example Field from the Grid (good!) b) Removed the Code_Example Field from the display view. (Not what I want) (a) is what I want, but I when I display the record, I need the field output on (b) the display view. Is it possible to do this using the grid? On Tuesday, June 11, 2013 5:49:08 PM UTC-4, Massimo Di Pierro wrote: I tried db.CodeMaster.Code_Example.readable = False I tried db.CodeMaster.Code_Example.writable = False Now put the two lines in the action before the grid(...) and it will only apply to that grid. On Tuesday, 11 June 2013 15:34:30 UTC-5, Joe Magaro wrote: Hi, I am just learning web2py and I have a working grid: form=SQLFORM.grid(db.CodeMaster,editable=auth.has_membership('Editor_Group'), create=auth.has_membership('Editor_Group'),deletable=auth.has_membership('Editor_Group') ) There is a field in db.CodeMaster that I would like to hide from the grid view, but have it shown in other views. I tried db.CodeMaster.Code_Example.readable = False That seemed to work except it removed it from all views except edit. Any help is appreciated! -- --- 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: response time impacted by compileapp
I thought I had precompiled my app, in this sense does precompile the app mean generating pyc's for all the relevant models? In that case, yes that was done. I haven't messed with conditional ones at all so far. It should also be mentioned that I experience the same response times when running from rocket as well as nginx+uwsgi. Matt On Wednesday, June 12, 2013 11:04:48 AM UTC-4, Niphlod wrote: given that you can pre-compile your app, did you test if the compilation time drops before moving around your models to use conditional ones ? On Wednesday, June 12, 2013 3:47:47 PM UTC+2, Matt wrote: Hi, We use web2py somewhat differently than most use cases in that we aren't using a database at all, but instead back our web2py app with connections to a server over a local unix RPC socket. We still use web2py to perform validations, and UI generation, so we have a bunch of models that basically contain gluon Field's, and then either call SQLFORM on that model's fields or serialize that model and send it over the wire. More specifically, we have a number of controllers that correspond to a model (controllers/foo.py, and a model/foo.py that we can call SQLFORM on to generate a form), and then we have a single rest.py controller that provides a rest interface to the rpc socket (rest.py basically mirrors all of the controllers with methods defined as: @request.restful(), validates the data using the correct model, and communicates over the rpc socket) I've been doing a number of benchmarks recently, and found that while it generally takes ~3.5ms to receive a response over the unix domain socket, calls to the web2py rest controller are taking somewhere around ~80-90ms to return. My suspicion is that this is because web2py is compiling all of the models for every request (running web2py with the profiler seems to corroborate this, indicating that most of the time spent in the response is in compileapp). From my reading it also seems that we can reduce the compilation time of compileapp by using conditional models, however the rest.py controller potentially uses all of them given which method is called in the controller. There also seems to be an undocumented response.models_to_run method that I'm not sure I understand fully. What would be the best way to reduce the response time of this rest.py controller? Can I put response.models_to_run inside each of the controller methods in rest.py, to ensure that only the models we need for the operation are compiled? Am I off track here, and the model compilation is not the source of latency? -- --- 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: response time impacted by compileapp
Yes, I started going down this path but it seems almost impossible. We use gluon.dal.Field in every model, as well as the T(..) function, and a number of other gluon-related classes/functions. I thought I could just import all of these and maintain all of our models as modules, but when I tried to use them in practice I received tons of errors about request or response not being available. Matt On Wednesday, June 12, 2013 11:16:45 AM UTC-4, Anthony wrote: response.models_to_run can't go in a controller because the controller isn't called until after models have been run. If you don't know which models you will need until you get to the controller, you can put model definitions into modules and import and run them when needed. Anthony On Wednesday, June 12, 2013 9:47:47 AM UTC-4, Matt wrote: Hi, We use web2py somewhat differently than most use cases in that we aren't using a database at all, but instead back our web2py app with connections to a server over a local unix RPC socket. We still use web2py to perform validations, and UI generation, so we have a bunch of models that basically contain gluon Field's, and then either call SQLFORM on that model's fields or serialize that model and send it over the wire. More specifically, we have a number of controllers that correspond to a model (controllers/foo.py, and a model/foo.py that we can call SQLFORM on to generate a form), and then we have a single rest.py controller that provides a rest interface to the rpc socket (rest.py basically mirrors all of the controllers with methods defined as: @request.restful(), validates the data using the correct model, and communicates over the rpc socket) I've been doing a number of benchmarks recently, and found that while it generally takes ~3.5ms to receive a response over the unix domain socket, calls to the web2py rest controller are taking somewhere around ~80-90ms to return. My suspicion is that this is because web2py is compiling all of the models for every request (running web2py with the profiler seems to corroborate this, indicating that most of the time spent in the response is in compileapp). From my reading it also seems that we can reduce the compilation time of compileapp by using conditional models, however the rest.py controller potentially uses all of them given which method is called in the controller. There also seems to be an undocumented response.models_to_run method that I'm not sure I understand fully. What would be the best way to reduce the response time of this rest.py controller? Can I put response.models_to_run inside each of the controller methods in rest.py, to ensure that only the models we need for the operation are compiled? Am I off track here, and the model compilation is not the source of latency? -- --- 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: response time impacted by compileapp
On Wednesday, June 12, 2013 1:35:11 PM UTC-4, Matt wrote: Yes, I started going down this path but it seems almost impossible. We use gluon.dal.Field in every model, as well as the T(..) function, and a number of other gluon-related classes/functions. I thought I could just import all of these and maintain all of our models as modules, but when I tried to use them in practice I received tons of errors about request or response not being available. If you need to access request, response, session, cache, or T in a module, use the current object: http://web2py.com/books/default/chapter/29/04#Accessing-the-API-from-Python-modules. If you show an example of some of your model code, perhaps we can suggest how you could do it in a module. Anthony -- --- 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: response time impacted by compileapp
Anthony, it looks like I was mistaken, I just got one of our more simple models to work as a module. I'll repost later with what I discover wrt response times. Thanks, Matt On Wednesday, June 12, 2013 1:50:54 PM UTC-4, Anthony wrote: On Wednesday, June 12, 2013 1:35:11 PM UTC-4, Matt wrote: Yes, I started going down this path but it seems almost impossible. We use gluon.dal.Field in every model, as well as the T(..) function, and a number of other gluon-related classes/functions. I thought I could just import all of these and maintain all of our models as modules, but when I tried to use them in practice I received tons of errors about request or response not being available. If you need to access request, response, session, cache, or T in a module, use the current object: http://web2py.com/books/default/chapter/29/04#Accessing-the-API-from-Python-modules. If you show an example of some of your model code, perhaps we can suggest how you could do it in a module. Anthony -- --- 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: response time impacted by compileapp
uhm. of course you have pyc files, but that's not what I meant. I meant hitting compile on the admin app. If you have an application/yourapp/compiled folder, then you have it compiled the way I meant. On Wednesday, June 12, 2013 7:32:30 PM UTC+2, Matt wrote: I thought I had precompiled my app, in this sense does precompile the app mean generating pyc's for all the relevant models? In that case, yes that was done. I haven't messed with conditional ones at all so far. It should also be mentioned that I experience the same response times when running from rocket as well as nginx+uwsgi. Matt On Wednesday, June 12, 2013 11:04:48 AM UTC-4, Niphlod wrote: given that you can pre-compile your app, did you test if the compilation time drops before moving around your models to use conditional ones ? On Wednesday, June 12, 2013 3:47:47 PM UTC+2, Matt wrote: Hi, We use web2py somewhat differently than most use cases in that we aren't using a database at all, but instead back our web2py app with connections to a server over a local unix RPC socket. We still use web2py to perform validations, and UI generation, so we have a bunch of models that basically contain gluon Field's, and then either call SQLFORM on that model's fields or serialize that model and send it over the wire. More specifically, we have a number of controllers that correspond to a model (controllers/foo.py, and a model/foo.py that we can call SQLFORM on to generate a form), and then we have a single rest.py controller that provides a rest interface to the rpc socket (rest.py basically mirrors all of the controllers with methods defined as: @request.restful(), validates the data using the correct model, and communicates over the rpc socket) I've been doing a number of benchmarks recently, and found that while it generally takes ~3.5ms to receive a response over the unix domain socket, calls to the web2py rest controller are taking somewhere around ~80-90ms to return. My suspicion is that this is because web2py is compiling all of the models for every request (running web2py with the profiler seems to corroborate this, indicating that most of the time spent in the response is in compileapp). From my reading it also seems that we can reduce the compilation time of compileapp by using conditional models, however the rest.py controller potentially uses all of them given which method is called in the controller. There also seems to be an undocumented response.models_to_run method that I'm not sure I understand fully. What would be the best way to reduce the response time of this rest.py controller? Can I put response.models_to_run inside each of the controller methods in rest.py, to ensure that only the models we need for the operation are compiled? Am I off track here, and the model compilation is not the source of latency? -- --- 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: serverlet with jsessionid
if you rewrite the request in the webserver before passing the request to web2py yes. BTW, that URL seems invalid. I'm not a strong RFC enforcer but AFAIK you can have a ; separator or a one, not both. details http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 and web2py doesn't handle the ; one by default, you should check the regexes in gluon.rewrite. On Wednesday, June 12, 2013 7:17:13 PM UTC+2, mweissen wrote: A web2py function calls a java serverlet. This serverlet calls back my web2py application and uses an url like http://mydomain/app/contr/anotherfunction*;jsessionid=1.2.3.4.abcd* ?var1=1var2=2 The part *;jsessionid=1.2.3.4.abcd* produces an invalid request. I cannot change the (foreign) serverlet. Is there any way to ignore the jsessionid-part? -- Regards Martin -- --- 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] Radio Buttons Random Order
Using Web2py, in the default controller, how can I randomize the order that the radio buttons appear on the screen? Ex: I don't want answer1 to appear before all of the other radio buttons all of the time. def index(): import random recaptcha_row = db(db.recaptcha_qa).select(orderby=random) for x in recaptcha_row: statement=x.statement question=x.question form = FORM( TR(x.answer1,INPUT(_type=radio, _name=operation, _value=answer1)), TR(x.answer2,INPUT(_type=radio, _name=operation, _value=answer2)), TR(x.answer3,INPUT(_type=radio, _name=operation, _value=answer3)), TR(x.answer4,INPUT(_type=radio, _name=operation, _value=answer4)), TR(,INPUT(_type=submit, _name=submit, _value=Submit)), ) if form.accepts(request.vars,session): if (form.vars.operation==answer1): redirect(URL(right_answer)) else: redirect(URL(wrong_answer)) return dict(statement=statement,question=question,form=form) def right_answer(): return dict() def wrong_answer(): return dict() -- --- 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: serverlet with jsessionid
did you meen to rewrite the serverlet? not possible, it's a foreign service. also i cannot change the delimiters. but i will have look at gluon.rewrite - thank you for this hint. but: if i had my own rewrite, i would have to take care of it on every web2py upgrade - is it right? 2013/6/12 Niphlod niph...@gmail.com if you rewrite the request in the webserver before passing the request to web2py yes. BTW, that URL seems invalid. I'm not a strong RFC enforcer but AFAIK you can have a ; separator or a one, not both. details http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2and web2py doesn't handle the ; one by default, you should check the regexes in gluon.rewrite. On Wednesday, June 12, 2013 7:17:13 PM UTC+2, mweissen wrote: A web2py function calls a java serverlet. This serverlet calls back my web2py application and uses an url like http://mydomain/app/contr/**anotherfunctionhttp://mydomain/app/contr/anotherfunction *;jsessionid=1.2.3.4.abcd*?var1=1var2=2 The part *;jsessionid=1.2.3.4.abcd* produces an invalid request. I cannot change the (foreign) serverlet. Is there any way to ignore the jsessionid-part? -- Regards Martin -- --- 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. -- --- 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: serverlet with jsessionid
maybe i can use routes.py to change an incoming url like http://mydomain/app/contr/anotherfunction*;jsessionid=1.2.3.4.abcd* ?var1=1var2=2 to http://mydomain/app/contr/anotherfunction*?jsessionid=1.2.3.4.abcd* var1=1var2=2 this would solve the problem. 2013/6/12 Martin Weissenboeck mweis...@gmail.com did you meen to rewrite the serverlet? not possible, it's a foreign service. also i cannot change the delimiters. but i will have look at gluon.rewrite - thank you for this hint. but: if i had my own rewrite, i would have to take care of it on every web2py upgrade - is it right? 2013/6/12 Niphlod niph...@gmail.com if you rewrite the request in the webserver before passing the request to web2py yes. BTW, that URL seems invalid. I'm not a strong RFC enforcer but AFAIK you can have a ; separator or a one, not both. details http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2and web2py doesn't handle the ; one by default, you should check the regexes in gluon.rewrite. On Wednesday, June 12, 2013 7:17:13 PM UTC+2, mweissen wrote: A web2py function calls a java serverlet. This serverlet calls back my web2py application and uses an url like http://mydomain/app/contr/**anotherfunctionhttp://mydomain/app/contr/anotherfunction *;jsessionid=1.2.3.4.abcd*?var1=1var2=2 The part *;jsessionid=1.2.3.4.abcd* produces an invalid request. I cannot change the (foreign) serverlet. Is there any way to ignore the jsessionid-part? -- Regards Martin -- --- 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. -- --- 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] Error in smartgrid after updating to Version 2.5.1-stable+timestamp.2013.06.11.08.00.05
My smartgrids are all failing when I have fields from multiple tables specified in the 'fields' argument. Here is a sample traceback: Traceback (most recent call last): File C:\dev\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/infocenter/controllers/administration.py http://127.0.0.1:8000/admin/default/edit/infocenter/controllers/administration.py, line 2360, in module File C:\dev\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 3022, in f return action(*a, **b) File C:/dev/web2py/applications/infocenter/controllers/administration.py http://127.0.0.1:8000/admin/default/edit/infocenter/controllers/administration.py, line 702, in permissions paginate=15, maxtextlength=45) File C:\dev\web2py\gluon\sqlhtml.py, line 2679, in smartgrid user_signature=user_signature, **kwargs) File C:\dev\web2py\gluon\sqlhtml.py, line 2377, in grid value = row[str(field)] File C:\dev\web2py\gluon\dal.py, line 6865, in __getitem__ return ogetattr(self, key) AttributeError: 'Row' object has no attribute 'description' Description is a field on a referenced table that is included in the fields argument. Worked until upgrade to 2.5.1. -Jim -- --- 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: Models - graph model, How to change 'Undefined' to chosen title?
El miércoles, 12 de junio de 2013 11:59:02 UTC-3, Michael Nagy escribió: Hi - I am a new web2py and graphviz user who finds the 'graph model' graphic generation to be invaluable. It isn't apparent how, or if, it is possible to specify the title text for the generated graphic, however. I always see 'Undefined'. I can save as a .dot file, manually edit it, and redisplay with graphviz, but I figure there is some simple way I have not found to specify the test in db.py (most likely). Anyone know how? - Michael Hi Michael You could have something like models/db_zmeta.py #if not IS_IN_PRODUCTION: meta_users = dict(group=u'Usuarios y Permisos', color='#F5D3FF') db.auth_user._meta_graphmodel = meta_users db.auth_group._meta_graphmodel = meta_users db.auth_membership._meta_graphmodel = meta_users db.auth_permission._meta_graphmodel = meta_users db.auth_event._meta_graphmodel = meta_users db.auth_cas._meta_graphmodel = meta_users meta_datos_basicos = dict(group=u'Datos Básicos', color='#CEFFA7') db.provincias._meta_graphmodel = meta_datos_basicos db.actividades_productivas._meta_graphmodel = meta_datos_basicos db.zonas._meta_graphmodel = meta_datos_basicos This allows you to group the tables in graph. Jose -- --- 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: serverlet with jsessionid
not sure that it works because rewrite needs to parse the urlanyway I was talking to rewrite that request using the rewrite of your webserver (hoping that you're not running web2py with rocket). If that's not the case, you must look into rewrite's regexes, and take care of it on web2py's updates. On Wednesday, June 12, 2013 9:46:10 PM UTC+2, mweissen wrote: maybe i can use routes.py to change an incoming url like http://mydomain/app/contr/anotherfunction*;jsessionid=1.2.3.4.abcd* ?var1=1var2=2 to http://mydomain/app/contr/anotherfunction*?jsessionid=1.2.3.4.abcd* var1=1var2=2 this would solve the problem. 2013/6/12 Martin Weissenboeck mwei...@gmail.com javascript: did you meen to rewrite the serverlet? not possible, it's a foreign service. also i cannot change the delimiters. but i will have look at gluon.rewrite - thank you for this hint. but: if i had my own rewrite, i would have to take care of it on every web2py upgrade - is it right? 2013/6/12 Niphlod nip...@gmail.com javascript: if you rewrite the request in the webserver before passing the request to web2py yes. BTW, that URL seems invalid. I'm not a strong RFC enforcer but AFAIK you can have a ; separator or a one, not both. details http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2and web2py doesn't handle the ; one by default, you should check the regexes in gluon.rewrite. On Wednesday, June 12, 2013 7:17:13 PM UTC+2, mweissen wrote: A web2py function calls a java serverlet. This serverlet calls back my web2py application and uses an url like http://mydomain/app/contr/**anotherfunctionhttp://mydomain/app/contr/anotherfunction *;jsessionid=1.2.3.4.abcd*?var1=1var2=2 The part *;jsessionid=1.2.3.4.abcd* produces an invalid request. I cannot change the (foreign) serverlet. Is there any way to ignore the jsessionid-part? -- Regards Martin -- --- 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. -- --- 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: Error in smartgrid after updating to Version 2.5.1-stable+timestamp.2013.06.11.08.00.05
yet another case to add tests to web2py :( . Please post a sample app to reproduce the issue. On Wednesday, June 12, 2013 9:56:45 PM UTC+2, Jim S wrote: My smartgrids are all failing when I have fields from multiple tables specified in the 'fields' argument. Here is a sample traceback: Traceback (most recent call last): File C:\dev\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/dev/web2py/applications/infocenter/controllers/administration.py http://127.0.0.1:8000/admin/default/edit/infocenter/controllers/administration.py, line 2360, in module File C:\dev\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:\dev\web2py\gluon\tools.py, line 3022, in f return action(*a, **b) File C:/dev/web2py/applications/infocenter/controllers/administration.py http://127.0.0.1:8000/admin/default/edit/infocenter/controllers/administration.py, line 702, in permissions paginate=15, maxtextlength=45) File C:\dev\web2py\gluon\sqlhtml.py, line 2679, in smartgrid user_signature=user_signature, **kwargs) File C:\dev\web2py\gluon\sqlhtml.py, line 2377, in grid value = row[str(field)] File C:\dev\web2py\gluon\dal.py, line 6865, in __getitem__ return ogetattr(self, key) AttributeError: 'Row' object has no attribute 'description' Description is a field on a referenced table that is included in the fields argument. Worked until upgrade to 2.5.1. -Jim -- --- 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: Radio Buttons Random Order
I wonder whether you could do something like this: input random answers = range(1,5) random.shuffle(answers) inputlist = CAT() for a in answers: inputlist.append(TR(x['answer{0}'.format(a)],INPUT(_type=radio, _name= operation, _value='answer{0}'.format(a form = FORM(TABLE(inputlist)) -- --- 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: SQLFROM.smartgrid in GAE, query not supported
from the book* Google NoSQL (Datastore)** does not allow joins, left joins, aggregates, expression, OR involving more than one table, the ‘like’ operator searches in text fields. * tl;dr : no references allowed AFAIK. On Wednesday, June 12, 2013 10:07:01 AM UTC+2, Jacinto Parga wrote: Hi, I have deployed a *SQLFORM.smartgrid* very simple book's example: *db.define_table('t_parent',Field('name'),format='%(name)s') db.define_table('child',Field('name'),Field('f_parent','reference t_parent'))* Controller *@auth.requires_login() def index(): db.child.f_parent.writable = False grid = SQLFORM.smartgrid(db.t_parent,linked_tables=['child'],create=True, editable=dict(t_parent=True,child=True)) return dict(grid=grid)* In view: *{{=grid}}* It works fine in localhost, works fine in pythonanywhere ( http://jparga.pythonanywhere.com/borrame/default/indexhttp://jparga.pythonanywhere.com/borrame/default/user/login?_next=/borrame/default/index ) BUT ,in* GAE *it doesn't work and dysplay the following message:* Query Not Supported: invalid filter: __key__ filter value must be a Key; received None (a NoneType)* (http://web2gae.appspot.com/borrame/default/index/) I have tried adding several requirements to db.child.f_parent, like IS_NOT_EMPTY, a default value and so on but it did'n work. Thanks for your help. -- --- 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: Stream WAV file from existing database
what's the problem ? BTW, you can define a Field('whatever', 'blob') as you wish, but you loose the facility of SQLFORMs (i.e. you need to do your own content negotiation, including how to store it, retrieve, and so on.) On Wednesday, June 12, 2013 2:45:22 AM UTC+2, Todd Ingarfield wrote: Hi, I am trying to stream a audio file (WAV) that is contained within a MySQL database. From doing some searching on the web to get around the audio content not being encoded base64 in the database I have the field defined in db.py as follows: Field('audio',type=SQLCustomType(type='string', native='blob')), Thanks in advance, Todd -- --- 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 Grid: Hiding from the main grid but show on other views
use the fields attribute of the grid. On Wednesday, June 12, 2013 1:35:03 AM UTC+2, Joe Magaro wrote: Hi Massimo. Perhaps I explained this incorrectly. When I added db.CodeMaster.Code_Example.readable = False that did two things: a) Removed the Code_Example Field from the Grid (good!) b) Removed the Code_Example Field from the display view. (Not what I want) (a) is what I want, but I when I display the record, I need the field output on (b) the display view. Is it possible to do this using the grid? On Tuesday, June 11, 2013 5:49:08 PM UTC-4, Massimo Di Pierro wrote: I tried db.CodeMaster.Code_Example.readable = False I tried db.CodeMaster.Code_Example.writable = False Now put the two lines in the action before the grid(...) and it will only apply to that grid. On Tuesday, 11 June 2013 15:34:30 UTC-5, Joe Magaro wrote: Hi, I am just learning web2py and I have a working grid: form=SQLFORM.grid(db.CodeMaster,editable=auth.has_membership('Editor_Group'), create=auth.has_membership('Editor_Group'),deletable=auth.has_membership('Editor_Group') ) There is a field in db.CodeMaster that I would like to hide from the grid view, but have it shown in other views. I tried db.CodeMaster.Code_Example.readable = False That seemed to work except it removed it from all views except edit. Any help is appreciated! -- --- 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 Grid: Hiding from the main grid but show on other views
I seem to remember doing something like this once - worth a try: if not 'view' in request.args: db.CodeMaster.Code_Example.readable = False db.CodeMaster.Code_Example.writable = False else: db.CodeMaster.Code_Example.readable = True db.CodeMaster.Code_Example.writable = False -- --- 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: Radio Buttons Random Order
Hmm unfortunately that didn't work, I appreciate the help though! On Wednesday, June 12, 2013 4:15:46 PM UTC-5, villas wrote: I wonder whether you could do something like this: input random answers = range(1,5) random.shuffle(answers) inputlist = CAT() for a in answers: inputlist.append(TR(x['answer{0}'.format(a)],INPUT(_type=radio,_name =operation, _value='answer{0}'.format(a form = FORM(TABLE(inputlist)) -- --- 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 Grid: Hiding from the main grid but show on other views
Thanks Villas! That did it! On Wednesday, June 12, 2013 5:41:56 PM UTC-4, villas wrote: I seem to remember doing something like this once - worth a try: if not 'view' in request.args: db.CodeMaster.Code_Example.readable = False db.CodeMaster.Code_Example.writable = False else: db.CodeMaster.Code_Example.readable = True db.CodeMaster.Code_Example.writable = False -- --- 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] d3.js stays in view even after selecting menu change
I was able to get this to work with further experimentation. I switched to jQuery-UI as you hinted and now it is working. I put an example of what I did on github so it may help others. https://github.com/greaneym/d3jsweb2py Thank you, Niphlod, Margaret On Tuesday, June 11, 2013 10:13:36 AM UTC-5, Niphlod wrote: usually with tabs you have to re-initiate your something as soon as the tab is shown because the element is hidden when the onload event is fired when loading the page. This happens, e.g., with google maps loaded in query ui tabs, so probably d3 has the same exact issue. Il giorno martedì 11 giugno 2013 16:55:54 UTC+2, Ramos ha scritto: I had problems also with fullcalendar inside twitter bootstrap tabs The fullcalendar only works in the first tab. Moving it to next tabs bring problems 2013/6/11 greaneym grea...@gmail.com I am learning D3 to use it in an app for visualization but having problems with multiple graphs loading when I only want one to show per menu selection. Using the bootstrap welcome app, I am able to load d3 examples using a tabbable nav menu, however, once loaded they do not go away between clicking tabs. Is the javascript functionality (below) to unload a default in web2py or do I have to put some code in to force an unload inbetween selections of the tab menu? body onunload=SomeJavaScriptCode window.onunload=function(){SomeJavaScriptCode}; I've also tried the following, 1. use a controller function that uses redirect to a url as in Massimo's Processing JS example, but that effect then loses the ability to use the tab menu. 2. instead of LOAD ing paths, I made the D3 views into files.js and LOADed those but the behavior is still the same. The graphs load but don't disappear between tab selections, or some of them do not. ( http://stackoverflow.com/questions/14389974/how-do-i-get-different-tabs-to-load-separate-javascript-files ) There are likely many ways to do this, but I haven't been successful yet at finding an answer. Thanks for any help. -- --- 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. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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] de language file of app admin broken
the german language file of the app admin is broken. umlauts are question marks. -- --- 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: Radio Buttons Random Order
How about something like: import random rows = random.shuffle([TR(x.answer1,INPUT(_type=radio, _name=operation,_value =answer1)), TR(x.answer2,INPUT(_type=radio, _name=operation,_value =answer2)), TR(x.answer3,INPUT(_type=radio, _name=operation,_value =answer3)), TR(x.answer4,INPUT(_type=radio, _name=operation,_value =answer4))]) rows.append(TR(,INPUT(_type=submit, _name=submit, _value=Submit))) form = FORM(TABLE(rows)) Anthony On Wednesday, June 12, 2013 2:38:31 PM UTC-4, Austin Nisenbaum wrote: Using Web2py, in the default controller, how can I randomize the order that the radio buttons appear on the screen? Ex: I don't want answer1 to appear before all of the other radio buttons all of the time. def index(): import random recaptcha_row = db(db.recaptcha_qa).select(orderby=random) for x in recaptcha_row: statement=x.statement question=x.question form = FORM( TR(x.answer1,INPUT(_type=radio, _name=operation, _value=answer1)), TR(x.answer2,INPUT(_type=radio, _name=operation, _value=answer2)), TR(x.answer3,INPUT(_type=radio, _name=operation, _value=answer3)), TR(x.answer4,INPUT(_type=radio, _name=operation, _value=answer4)), TR(,INPUT(_type=submit, _name=submit, _value=Submit)), ) if form.accepts(request.vars,session): if (form.vars.operation==answer1): redirect(URL(right_answer)) else: redirect(URL(wrong_answer)) return dict(statement=statement,question=question,form=form) def right_answer(): return dict() def wrong_answer(): return dict() -- --- 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.