[web2py] Re: What is proper requires= validator for foreign key?
Yes. Looks like a bug. My previous information wasn't completly correct, so I try better: It looks like there are 2 calls of represent= function in smartgrid. One call requires 2 parameters and second call 1 parameter. There is a possible solution: Function can be called with 2nd parameter optional: Field('parent_id', db.parent, requires=IS_IN_DB(db, db.parent.id), represent=lambda id, r=None: db.parent._format % db.parent(id) if id else '') Then all smartgrids work properly. So fixing would be great, but not immediately neccessary. Dne pátek, 14. února 2014 15:44:18 UTC+1 Anthony napsal(a): Looks like a bug in smartgrid -- I'll submit a patch. Anthony On Friday, February 14, 2014 5:32:35 AM UTC-5, Mirek Zvolský wrote: Great. Thank you. (of course it would be much easier, if use of explicit requires= will cause nothing with implicit represent=) But in one detail it must be different as your version: If I try Field('parent_id', db.parent, requires=IS_IN_DB(db, db.parent.id), represent=lambda id, r: db.parent._format % db.parent(id) if id else '') this works well in appadmin, however it causes internal error in smartgrid: File C:\Python27\Lib\site-packages\web2py_2_8_2\web2py\gluon\sqlhtml.py, line 2764, in smartgrid user_signature=user_signature, **kwargs) File C:\Python27\Lib\site-packages\web2py_2_8_2\web2py\gluon\sqlhtml.py, line 2450, in grid value = field.represent(value, row) File C:\Python27\Lib\site-packages\web2py_2_8_2\web2py\gluon\sqlhtml.py, line 2708, in lambda field.represent = lambda id, r=None, referee=referee, rep=field.represent: A(callable(rep) and rep(id) or id, cid=request.cid, _href=url(args=['view', referee, id])) TypeError: lambda() takes exactly 2 arguments (1 given) This looks like proper solution: Field('parent_id', db.parent, requires=IS_IN_DB(db, db.parent.id), represent=lambda id: db.parent._format % db.parent(id) if id else '') So - your solution, but lambda with 1 parameter only. Thanks, Mirek Dne pátek, 14. února 2014 0:26:45 UTC+1 Anthony napsal(a): If you don't explicitly specify a validator for a reference field and the referenced table has a format attribute, then you get a default validator *and* a default represent attribute (the represent attribute is what is used for read-only displays). However, if you explicitly specify your own validator, then you no longer get the default represent attribute either, and so you must explicitly provider your own. You could do something like: Field('myfield', 'represent othertable', requires=..., represent=lambda id, r: db.othertable._format % db.othertable(id) if id else '') Anthony On Thursday, February 13, 2014 6:08:55 PM UTC-5, Mirek Zvolský wrote: As user of my application I don't want see any ID's at all - instead I want always see record content formatted from format=.. In smartgrid I am able to receive records instead of ID's only, if I run with default validator for foreign key (i.e. without requires=..) In such case (without requires=..) I see related records for readonly foreign keys (View) and for readwrite foreign keys (Edit). If I use requires=.. then for readonly foreign keys I see ID's and I have no idea, how to prevent it. If I need a foreign key, which should be None for some records, then I think it is necessary to use requires=IS_EMPTY_OR(IS_IN_DB(db, db.parent.id)) However this will display ID's instead of formatted records for readonly foreign keys. :((( How to do it proper? Can represent=.. help? Or? I try it with 2.8.2 version. Thanks for help ! (Note: I don't know, if answer to my question was same in older versions, or if it has changed in 2,8.2 with new constraint handling for SQLite.) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: HELP with bootstrap 3
in my POV instead of reducing all alterations of default widgets in javascript we should ship new widget sets alltogether. This was discussed long ago but nobody seemed to care we can't really start supporting every css framework out there unless we change the way widgets are generated. Going bootstrap3 with this much FOUC is good for a plugin proof-of-concept but I'd not ship it as a scaffolding application... On Monday, February 24, 2014 7:12:22 AM UTC+1, Massimo Di Pierro wrote: Can we get rid of web2py-bootstrap3.js? Do we all these files? web2py.css bootstrap-responsive.min.css bootstrap-theme.min.css web2py-bootstrap3.css web2py_bootstrap.css web2py_bootstrap_nojs.css can we reduce to two: web2py.css web2py-bootstrap3.css On Monday, 24 February 2014 00:09:48 UTC-6, Massimo Di Pierro wrote: Added some of the missing files. They were created by Paolo but it was my mistake not to post them. They should address most of the issues. On Sunday, 23 February 2014 23:51:04 UTC-6, Ron McOuat wrote: I found this on Stack Overflow http://stackoverflow.com/questions/16214326/bootstrap-dropdown-with-hover ul.nav li.dropdown:hover ul.dropdown-menu { display: block; } and I find this solution using CSS in the .css file under welcome named static/css/web2py_bootstrap_nojs.css but not in any other css file. However this file is not included by another file anywhere in the welcome application. If this is it I just got lucky is all. :-) The Welcome application name header is scrunched up under the menu bar and partially visible lastest Firefox Ubuntu 12.04 LTS The web2py menu item (yellow) doesn't open like in 2.8.2 Ron -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using web2py build-in serwer
It's a bit hidden in the deployment recipes page but as far as I know the easiest way to make your site go live using the built in server is this: An easy way to setup a secure production environment on a server is to first stop web2py and then remove all the parameters_*.py files from the web2py installation folder. Then start web2py without a password. This will completely disable admin and appadmin. nohup python web2py --nogui -p 8001 -i 127.0.0.1 -a '' More details on how to access admin securely here: http://web2py.com/books/default/chapter/29/13/deployment-recipes#Securing-sessions-and-admin On Saturday, February 22, 2014 6:32:49 PM UTC, aslav wrote: Hi there, I'm new to programming, python and web2py. I have a question - Can I use web2py build-in server insted of apache if I'm just running a small ( really small ) website with couple of visits and file downloads per day? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: HELP with bootstrap 3
How about putting Paolo's bootstrap3.py into contrib an have welcome app import it from there? His module provides most of the bootstrap 3 support (forms, navigation, etc.). We could remove all this from core web2py. As for the welcome app static files, these are redundant (leftovers) now and should be deleted: static/css/bootstrap-responsive.min.css static/css/web2py_bootstrap.css static/css/web2py_bootstrap_nojs.css static/js/dd_belatedpng.js static/js/web2py_bootstrap.js This one is old (v3.0.3, should be v3.1.1): static/css/bootstrap-theme.min.css I think we should define modernizr.custom.js to use a CDN and remove it from the static files too, same as respond.min.js is defined now. I also think we should be suggesting users to use a free CDN instead of Maxcdn, so this should be in layout.html instead of what is now: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.min.js download it in static/js sub-folder and replace the script link in the following conditional comment with script src={{=URL('static',_plugin_layout_static+'/'+'js/modernizr.min.js')}}/script script src={{=URL('static',_plugin_layout_static+'/'+'js/modernizr.min.js')}}/script-- !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js;/script -- !--[if lt IE 9] script src=https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js;/script ![endif]-- Another minor thing for the new layout.html: header section should also have id=header, same as other sections have. I didn't have time to test the changes to gluon/tools.py yet, I'll check out trunk a bit later... Regards On Monday, February 24, 2014 9:40:22 AM UTC+1, Niphlod wrote: in my POV instead of reducing all alterations of default widgets in javascript we should ship new widget sets alltogether. This was discussed long ago but nobody seemed to care we can't really start supporting every css framework out there unless we change the way widgets are generated. Going bootstrap3 with this much FOUC is good for a plugin proof-of-concept but I'd not ship it as a scaffolding application... On Monday, February 24, 2014 7:12:22 AM UTC+1, Massimo Di Pierro wrote: Can we get rid of web2py-bootstrap3.js? Do we all these files? web2py.css bootstrap-responsive.min.css bootstrap-theme.min.css web2py-bootstrap3.css web2py_bootstrap.css web2py_bootstrap_nojs.css can we reduce to two: web2py.css web2py-bootstrap3.css On Monday, 24 February 2014 00:09:48 UTC-6, Massimo Di Pierro wrote: Added some of the missing files. They were created by Paolo but it was my mistake not to post them. They should address most of the issues. On Sunday, 23 February 2014 23:51:04 UTC-6, Ron McOuat wrote: I found this on Stack Overflow http://stackoverflow.com/questions/16214326/bootstrap-dropdown-with-hover ul.nav li.dropdown:hover ul.dropdown-menu { display: block; } and I find this solution using CSS in the .css file under welcome named static/css/web2py_bootstrap_nojs.css but not in any other css file. However this file is not included by another file anywhere in the welcome application. If this is it I just got lucky is all. :-) The Welcome application name header is scrunched up under the menu bar and partially visible lastest Firefox Ubuntu 12.04 LTS The web2py menu item (yellow) doesn't open like in 2.8.2 Ron -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] email on logging in is case sensitive. Is this a good idea?
I run a site for a jazz club with ticket booking. Today I had an irate customer because they had previously registered and booked tickets. They then could not log in. The reason was that they had an upper case letter as the first letter of their email. It would seem better to me if the email used for registration and logging in where case insensitive. Should I make this an issue? Peter -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: email on logging in is case sensitive. Is this a good idea?
Okay I see that this is already attended to by the following setting auth.settings.email_case_sensitive = False So I guess my comment would be - Wouldn't it be better if the default setting is False rather than True. Peter -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: email on logging in is case sensitive. Is this a good idea?
It is sensitive by default, and by design: http://email.about.com/od/emailbehindthescenes/f/email_case_sens.htm :( but not by implementation, i don't think anyone is using case sensitive emails. I'd like to see the above line in welcome app, as I have it in all my apps. Marin On Mon, Feb 24, 2014 at 12:40 PM, peter peterchutchin...@gmail.com wrote: Okay I see that this is already attended to by the following setting auth.settings.email_case_sensitive = False So I guess my comment would be - Wouldn't it be better if the default setting is False rather than True. Peter -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: HELP with bootstrap 3
Note to those not reading this group from a web interface: I edited my post to fix copy paste typos in the code. This is the correct code again: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/ modernizr.min.js/script -- !--[if lt IE 9] script src=https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4. 2/respond.js/script ![endif]-- I apologize for the mix up. Regards On Monday, February 24, 2014 12:28:19 PM UTC+1, LightDot wrote: How about putting Paolo's bootstrap3.py into contrib an have welcome app import it from there? His module provides most of the bootstrap 3 support (forms, navigation, etc.). We could remove all this from core web2py. As for the welcome app static files, these are redundant (leftovers) now and should be deleted: static/css/bootstrap-responsive.min.css static/css/web2py_bootstrap.css static/css/web2py_bootstrap_nojs.css static/js/dd_belatedpng.js static/js/web2py_bootstrap.js This one is old (v3.0.3, should be v3.1.1): static/css/bootstrap-theme.min.css I think we should define modernizr.custom.js to use a CDN and remove it from the static files too, same as respond.js is defined now. I also think we should be suggesting users to use a free CDN instead of Maxcdn, so this should be in layout.html instead of what is now: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src= https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js;/script -- !--[if lt IE 9] script src= https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js /script ![endif]-- Another minor thing for the new layout.html: header section should also have id=header, same as other sections have. I didn't have time to test the changes to gluon/tools.py yet, I'll check out trunk a bit later... (note: edited to fix a typo in the code) Regards On Monday, February 24, 2014 9:40:22 AM UTC+1, Niphlod wrote: in my POV instead of reducing all alterations of default widgets in javascript we should ship new widget sets alltogether. This was discussed long ago but nobody seemed to care we can't really start supporting every css framework out there unless we change the way widgets are generated. Going bootstrap3 with this much FOUC is good for a plugin proof-of-concept but I'd not ship it as a scaffolding application... On Monday, February 24, 2014 7:12:22 AM UTC+1, Massimo Di Pierro wrote: Can we get rid of web2py-bootstrap3.js? Do we all these files? web2py.css bootstrap-responsive.min.css bootstrap-theme.min.css web2py-bootstrap3.css web2py_bootstrap.css web2py_bootstrap_nojs.css can we reduce to two: web2py.css web2py-bootstrap3.css On Monday, 24 February 2014 00:09:48 UTC-6, Massimo Di Pierro wrote: Added some of the missing files. They were created by Paolo but it was my mistake not to post them. They should address most of the issues. On Sunday, 23 February 2014 23:51:04 UTC-6, Ron McOuat wrote: I found this on Stack Overflow http://stackoverflow.com/questions/16214326/bootstrap-dropdown-with-hover ul.nav li.dropdown:hover ul.dropdown-menu { display: block; } and I find this solution using CSS in the .css file under welcome named static/css/web2py_bootstrap_nojs.css but not in any other css file. However this file is not included by another file anywhere in the welcome application. If this is it I just got lucky is all. :-) The Welcome application name header is scrunched up under the menu bar and partially visible lastest Firefox Ubuntu 12.04 LTS The web2py menu item (yellow) doesn't open like in 2.8.2 Ron -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: email on logging in is case sensitive. Is this a good idea?
We can't change the default due to backward compatibility, but as Marin suggests, I suppose we could change it in the welcome app. Feel free to post an issue. Anthony On Monday, February 24, 2014 6:40:24 AM UTC-5, peter wrote: Okay I see that this is already attended to by the following setting auth.settings.email_case_sensitive = False So I guess my comment would be - Wouldn't it be better if the default setting is False rather than True. Peter -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: email on logging in is case sensitive. Is this a good idea?
Thanks for the information Marin. I am amazed that they were defined in this way. You learn something new every day. However as it says in your link Hardly any email service or ISP does enforce case sensitive email addresses, returning messages whose recipient's email address was not typed correctly (in all upper case, for example). So I would have thought that case insensitivity is the better default in web2py. When I look at who has registered on the jazz site there are quite a few who have registered with and upper case first letter and then registered again later with all lower case. This is no doubt because they could not log in. I imagine that this issue has occurred on a number of web2py sites. Peter -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: REF: Issue with uploading files with web2py
Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: REF: Issue with uploading files with web2py
Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abasta...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: AJAX component reload problem using .html vs .load
Is the below your exact code? I ask because in stats_del, you refer to a variable a0 that has not been defined (presumably it is request.args(0)). Also, your click handler refers to a .del-div class, but I don't see any elements with that class. Anyway, by default, if an incoming URL has no extension, .html is assumed, so: {{=LOAD('user','stats', args=[user.id], target='stats-ajax', ajax=True,content ='')}} will look for a /views/user/stats.html view. If you instead want to use a stats.load view, you have to explicitly specify the .load extension: {{=LOAD('user','stats.load', args=[user.id], target='stats-ajax', ajax=True,content ='')}} Finally, this: URL(TIP_APP+'/user', 'stat_del', str(row.id)) is the wrong way to call the URL function. It happens to work in your case by accident (the first argument is interpreted as the app, the second as the controller, and the third as the function, when in fact the first is really the app+controller, the second the function, and the third is an arg). Instead, it should be: URL(TIP_APP, 'user', 'stat_del', args=str(row.id)) or more simply: URL('user', 'stat_del', args=str(row.id)) Note, you can leave out the app name, as it will get included automatically. Anthony On Sunday, February 23, 2014 11:15:32 PM UTC-5, Dan M wrote: In the following code, when pressing the X link, the row and DIV are deleted and the component is refreshed in the controller function stat_del(). This only works when the loaded component is named .html rather than .load So this code works but the .load naming does not work. *** *** CONTROLLER: user.py *** *** def stats(): user = session.r_cur_user tipuser = session.r_tip_user query = (Stat.crea_id==user.id) rows = db(query).select(orderby=~Stat.time_stamp) return locals() def stat_del(): db(Stat.id==a0).delete() response.js = jQuery('#stats-ajax').get(0).reload(); return locals() * *** LOADED: stats.html *** * {{for row in rows:}} div class='tip-del-div-wrapper' div class='tip-del-div'{{=A('X', _class=tip-del, _style=margin-top: 2px;, callback=URL(TIP_APP+'/user', 'stat_del', str( row.id)))}}/div /div div class='tip-body tpf-body' p class=expand-desc tpf-body style='margin-left: 6px; margin-right: 18px;'{{=Status goes here}}/p p class=expand-desc tpf-body style='margin-left: 6px;'{{=Time stamp goes here}}/p /div {{pass}} script $('.del-div').on('click', function(){ $(this).parent().parent().remove(); }); /script *** MAIN VIEW: home.html *** {{left_sidebar_enabled,right_sidebar_enabled=True,True}} {{extend 'layout.html'}} {{block profile}} {{=LOAD('user','profile',user.id,ajax=True, content='')}} {{end}} {{block follows}} {{=LOAD('user','friends',user.id,ajax=True, content='')}} {{end}} {{block center}} div class=tabbable ul class=nav nav-tabs li class=activea href=#tab3 data-toggle=tabStatus/a/li lia href=#tab2 data-toggle=tabReceived/a/li lia href=#tab1 data-toggle=tabGiven/a/li /ul div class=tab-content style=overflow-x:hidden; {{if user.creator:}} {{block stats}} div class=tab-pane active id=tab3 style=width:100%;height:70%;overflow-y:auto; overflow-x:hidden; {{if mypage:}} {{=LOAD('user','stat', args=[user.id], target='stat-ajax', ajax=True, content='')}} {{pass}} {{=LOAD('user','stats', args=[user.id], target='stats-ajax', ajax=True, content='')}} /div {{end}} {{pass}} /div /div {{end}} -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: REF: Issue with uploading files with web2py
Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com javascript: wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Date display i18n internationalization?
I get it now. You need: T.current_languages = [] Otherwise this is set to T.current_languages = ['en'] and it things the current language is english and therefore it does not need translation. On Monday, 24 February 2014 01:45:49 UTC-6, User wrote: In fact, if I put an entry in en-gb.py and set my browser accept-language to en-gb it will correctly pick up this string, but for some reason it's not picking up the string in en-us (unless I'm doing something wrong). Also interesting to note, is when I view my site with en-gb or es as the accept lang, web2py seems to automatically modify the en-gb.py and es.py files with default entries for every default string, whereas it's not doing that for en-us.py Does this have to with en-us.py being a default or something? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] pg8000 driver that comes with web2py 2.8.2 is not supporting JSON field type?
I'm getting a: class 'gluon.contrib.pg8000.errors.NotSupportedError' type oid 114 not mapped to py type I'm wondering what's the best thing to do now? Currently I'm considering: - using TEXT instead. But my former JSON strings are then enclosed by | which leads to new errors - updating gp8000 (there seems to be a newer version, but the version numbering is confusing) - using psycopg2. How can I install this into an Mac OS standalone version of web2py? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: REF: Issue with uploading files with web2py
I am using dhtmlx (www.dhtmlx.com) framework. The component am using is dhtmlxform. I don't understand what you mean by class and attribute. On 24 Feb 2014 14:45, Anthony abasta...@gmail.com wrote: Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: username and email login (auth)
http://www.web2pyslices.com/slice/show/1642/login-with-username-and-email On Friday, December 9, 2011 1:22:57 PM UTC+1, Francisco Costa wrote: lots of users on login form submit their email instead of the username.. it seems that auth.define_tables(username=True) forces username login but it is possible to have both? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: REF: Issue with uploading files with web2py
The output of type(request.vars.photo) and dir(request.vars.photo). On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote: I am using dhtmlx (www.dhtmlx.com) framework. The component am using is dhtmlxform. I don't understand what you mean by class and attribute. On 24 Feb 2014 14:45, Anthony abas...@gmail.com javascript: wrote: Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: REF: Issue with uploading files with web2py
the output is: Dir: ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'] type: type 'str' On Mon, Feb 24, 2014 at 3:40 PM, Anthony abasta...@gmail.com wrote: The output of type(request.vars.photo) and dir(request.vars.photo). On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote: I am using dhtmlx (www.dhtmlx.com) framework. The component am using is dhtmlxform. I don't understand what you mean by class and attribute. On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote: Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA
Re: [web2py] Re: REF: Issue with uploading files with web2py
You'll have the check the JS framework docs to see how/where it is posting the file (e.g., maybe via a separate Ajax request). On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote: the output is: Dir: ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'] type: type 'str' On Mon, Feb 24, 2014 at 3:40 PM, Anthony abas...@gmail.com javascript:wrote: The output of type(request.vars.photo) and dir(request.vars.photo). On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote: I am using dhtmlx (www.dhtmlx.com) framework. The component am using is dhtmlxform. I don't understand what you mean by class and attribute. On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote: Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it,
Re: [web2py] Re: REF: Issue with uploading files with web2py
What am supposed to see in dir and type? So that I can debug On 24 Feb 2014 16:16, Anthony abasta...@gmail.com wrote: You'll have the check the JS framework docs to see how/where it is posting the file (e.g., maybe via a separate Ajax request). On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote: the output is: Dir: ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'] type: type 'str' On Mon, Feb 24, 2014 at 3:40 PM, Anthony abas...@gmail.com wrote: The output of type(request.vars.photo) and dir(request.vars.photo). On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote: I am using dhtmlx (www.dhtmlx.com) framework. The component am using is dhtmlxform. I don't understand what you mean by class and attribute. On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote: Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To
Re: [web2py] Re: REF: Issue with uploading files with web2py
Well, it's just a string, so that's not the file. You have to figure out how the JS library is sending the file to the server. On Monday, February 24, 2014 9:18:32 AM UTC-5, software.ted wrote: What am supposed to see in dir and type? So that I can debug On 24 Feb 2014 16:16, Anthony abas...@gmail.com javascript: wrote: You'll have the check the JS framework docs to see how/where it is posting the file (e.g., maybe via a separate Ajax request). On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote: the output is: Dir: ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'] type: type 'str' On Mon, Feb 24, 2014 at 3:40 PM, Anthony abas...@gmail.com wrote: The output of type(request.vars.photo) and dir(request.vars.photo). On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote: I am using dhtmlx (www.dhtmlx.com) framework. The component am using is dhtmlxform. I don't understand what you mean by class and attribute. On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote: Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com -
Re: [web2py] Re: Web2py Integration with Multiple Oauth Logins
Hi there, I changed that field as well. (and another field) about the w2p: Don't know whats going on there. But I tarred it myself using 7zip but apparently that doesn't work. I cannot package or upload using the admin interface on my GAE dev server, gives internal error. Could someone give me the steps to properly package a w2p without using the admin interface? (I removed it from the repo) Quint On Sunday, February 23, 2014 10:21:05 PM UTC+1, James Q wrote: Hello again, Thanks for taking your time to engage with me. Hopefully I can get this working sometime soon. Regarding the update, I re-cloned the repository and notied a w2p file there. I used this file to upload to the web2py admin interface, which gives me the same error as before. Are you saying that I need to extract it first, add my keys to it, and then try uploading it? Either way, I did it manually using tar and I get this traceback now, which is similar to the above: Traceback (most recent call last): File /home/james/Development/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/james/Development/web2py/applications/oauth/models/plugin_social_auth.py http://127.0.0.1/admin/edit/oauth/models/plugin_social_auth.py, line 7, in module Field('user', 'reference auth_user', writable=False, notnull=True)) File /home/james/Development/web2py/gluon/dal.py, line 8139, in define_table table = self.lazy_define_table(tablename,*fields,**args) File /home/james/Development/web2py/gluon/dal.py, line 8156, in lazy_define_table table = table_class(self, tablename, *fields, **args) File /home/james/Development/web2py/gluon/dal.py, line 8665, in __init__ check_reserved(field_name) File /home/james/Development/web2py/gluon/dal.py, line 7850, in check_reserved_keyword 'invalid table/column name %s is a %s reserved SQL/NOSQL keyword' % (name, backend.upper())) SyntaxError: invalid table/column name user is a ALL reserved SQL/NOSQL keyword Guess that needs to be changed as well :) -- James On Sat, Feb 22, 2014 at 3:41 AM, Quint muijse...@gmail.com javascript:wrote: Hi, About the exception: I changed the Field name to oauth_uid. I did not notice this problem because i'm using GAE. About *App does not exist or you are not authorized*: This means that your oauth key/secret is not properly set in your configuration. You are not supplying a valid/authorized oauth client key to the provider. Which provider is giving this message? What does your configuration look like? What is find strange is that that plugin packed/installed by yourself is giving different result than te one installed manually. This should be exactly the same right? Are you sure everything is included in the one packed by yourself? Regards, Quint On Saturday, February 22, 2014 4:15:11 AM UTC+1, James Q wrote: Interesting plugin, thanks for the link. I took that repository, tar'ed and gzip'ed it, and uploaded it as a plugin. Says App does not exist or you are not authorized. No idea what that means, so I did it manually in a new app called oauth. Here is what I get as an exception when trying to open up the new app: Traceback (most recent call last): File /home/james/Development/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/james/Development/deemok-web2py/applications/oauth/models/plugin_social_auth.py http://127.0.0.1/admin/edit/oauth/models/plugin_social_auth.py, line 7, in module Field('user', 'reference auth_user', writable=False, notnull=True)) File /home/james/Development/web2py/gluon/dal.py, line 8139, in define_table table = self.lazy_define_table(tablename,*fields,**args) File /home/james/Development/web2py/gluon/dal.py, line 8156, in lazy_define_table table = table_class(self, tablename, *fields, **args) File /home/james/Development/web2py/gluon/dal.py, line 8665, in __init__ check_reserved(field_name) File /home/james/Development/web2py/gluon/dal.py, line 7850, in check_reserved_keyword 'invalid table/column name %s is a %s reserved SQL/NOSQL keyword' % (name, backend.upper())) SyntaxError: invalid table/column name uid is a ALL reserved SQL/NOSQL keyword Can you possibly rename the field: Field('uid', 'string', notnull=True, writable=False, length=255), to: Field('oauth_uid', 'string', notnull=True, writable=False, length=255), Or something along those lines? On Friday, February 21, 2014 3:55:00 AM UTC-5, Quint wrote: Hi, You could have a look at python-social-authhttps://github.com/omab/python-social-auth and if you like it and don't know how to integrate it, have a look at this plugin https://code.google.com/p/w2p-social-auth/ to integrate it in web2py. Quint On Wednesday, February 19, 2014 12:33:29 AM UTC+1, James Q wrote: I have a
Re: [web2py] Re: REF: Issue with uploading files with web2py
Ok let me check will revert at least you have given me a head start! On 24 Feb 2014 16:27, Anthony abasta...@gmail.com wrote: Well, it's just a string, so that's not the file. You have to figure out how the JS library is sending the file to the server. On Monday, February 24, 2014 9:18:32 AM UTC-5, software.ted wrote: What am supposed to see in dir and type? So that I can debug On 24 Feb 2014 16:16, Anthony abas...@gmail.com wrote: You'll have the check the JS framework docs to see how/where it is posting the file (e.g., maybe via a separate Ajax request). On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote: the output is: Dir: ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'] type: type 'str' On Mon, Feb 24, 2014 at 3:40 PM, Anthony abas...@gmail.com wrote: The output of type(request.vars.photo) and dir(request.vars.photo). On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote: I am using dhtmlx (www.dhtmlx.com) framework. The component am using is dhtmlxform. I don't understand what you mean by class and attribute. On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote: Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit
[web2py] How to pre filter a table I want to join.
Hi, I want to join t_a and t_b: rows = db(db.t_a.created_by == auth.user.id).select(join=db.t_b.on(db.t_a.f_y == db.t_b.id)) that works, But first I want to filter out t_b, for example: t_b to include only records where f_x == 3. what I tried did not work, it just ignored it, nothing was filtered: t_b = db.t_b.f_x ==3 rows = db(db.t_a.created_by == auth.user.id).select(join=db.t_b.on(db.t_a.f_test == db.t_b.id)) So what is the way to do it? thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to pre filter a table I want to join.
t_b = db.t_b.f_x ==3 Doesn't look like you do anything with the above. Why not: rows = db((db.t_a.created_by == auth.user.id) (db.t_b.f_x == 3)).select( join=db.t_b.on(db.t_a.f_test == db.t_b.id)) Note, you can also do a join via: rows = db((db.t_a.created_by == auth.user.id) (db.t_b.f_x == 3) (db.t_a.f_test == db.t_b.id)).select() Technically, that will implement the join via a SQL WHERE clause rather than the JOIN statement. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to pre filter a table I want to join.
thanks, yes i just realised i don't need the joint for the filtering. On Monday, February 24, 2014 4:57:37 PM UTC+2, Anthony wrote: t_b = db.t_b.f_x ==3 Doesn't look like you do anything with the above. Why not: rows = db((db.t_a.created_by == auth.user.id) (db.t_b.f_x == 3)).select( join=db.t_b.on(db.t_a.f_test == db.t_b.id)) Note, you can also do a join via: rows = db((db.t_a.created_by == auth.user.id) (db.t_b.f_x == 3) (db.t_a.f_test == db.t_b.id)).select() Technically, that will implement the join via a SQL WHERE clause rather than the JOIN statement. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: username and email login (auth)
Not sure this approach work with ldap_auth.py contrib... Richard On Mon, Feb 24, 2014 at 8:37 AM, Ruud Schroen r...@formatics.nl wrote: http://www.web2pyslices.com/slice/show/1642/login-with-username-and-email On Friday, December 9, 2011 1:22:57 PM UTC+1, Francisco Costa wrote: lots of users on login form submit their email instead of the username.. it seems that auth.define_tables(username=True) forces username login but it is possible to have both? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Change color of grid=SQLFORM.grid(db.abc, user_Signature=False)
Figured it out using Firebug and wanted to share my answer: To change the font colors inside the grid feature you have to create a CSS sheet (I called my tablebackground.css) and import it whenever I have a table. Then add this line: .odd.with_id {color: black;} There is also an even.with_id that web2py uses when converting sql databases into a form. Hope this helps someone else. Best, Austin On Friday, February 21, 2014 4:15:41 PM UTC-5, Austin Taylor wrote: I apologize for the vagueness. Part of that is my lack of knowledge and not knowing what to provide in the question. Thanks for responding, LightDot. I am using firebug and when I load the page it gives me 5 css scripts: background.css bootstrap-responsive.min.css bootstrap.min.css calendar.css (that one has a checkmark) web2py.css web2py_bootstrap.css You mentioned overriding the CSS Setting. How would I do so? On Friday, February 21, 2014 2:47:11 PM UTC-5, LightDot wrote: Question is a bit vague, yes ;) Like going to a mechanic and saying you want your car fixed, without any additional information and without showing your car. Grid is basically a html table, you have borders, rows, columns, fields, font colors, etc. etc. If your CSS template is overriding the Bootstrap's and web2py's CSS, then there is no magic one liner that will change all that back into something else. You need to redefine all CSS values that you want changed. This can be done for the grid alone. I suggest looking at your grid's CSS with a developer tool within your browser (all modern browsers have those built in, or you can use a plugin like Firebug for Firefox). This will show you which CSS definitions cause the color changes and which CSS file are they coming from. Then you can override them. Regards On Friday, February 21, 2014 5:31:35 PM UTC+1, Austin Taylor wrote: Really need help with this so if my question isn't clear please let me know and i'll try to rephrase. On Thursday, February 20, 2014 11:16:50 AM UTC-5, Austin Taylor wrote: I'm currently using a CSS template in my layout, but it changed my grid spreadsheet to an unreadable color. I've tried playing with the different css settings with no luck. Is there a way to just change the spreadsheet color? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: HELP with bootstrap 3
I'm not confortable with having something cdn dependant. By default apps should be available also if no internet connectivity is assured. +1 with defaulting to local and a comment to enable the cdn version. On Monday, February 24, 2014 1:05:13 PM UTC+1, LightDot wrote: Note to those not reading this group from a web interface: I edited my post to fix copy paste typos in the code. This is the correct code again: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/ modernizr.min.js/script -- !--[if lt IE 9] script src=https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4. 2/respond.js/script ![endif]-- I apologize for the mix up. Regards On Monday, February 24, 2014 12:28:19 PM UTC+1, LightDot wrote: How about putting Paolo's bootstrap3.py into contrib an have welcome app import it from there? His module provides most of the bootstrap 3 support (forms, navigation, etc.). We could remove all this from core web2py. As for the welcome app static files, these are redundant (leftovers) now and should be deleted: static/css/bootstrap-responsive.min.css static/css/web2py_bootstrap.css static/css/web2py_bootstrap_nojs.css static/js/dd_belatedpng.js static/js/web2py_bootstrap.js This one is old (v3.0.3, should be v3.1.1): static/css/bootstrap-theme.min.css I think we should define modernizr.custom.js to use a CDN and remove it from the static files too, same as respond.js is defined now. I also think we should be suggesting users to use a free CDN instead of Maxcdn, so this should be in layout.html instead of what is now: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src= https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js;/script -- !--[if lt IE 9] script src= https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js /script ![endif]-- Another minor thing for the new layout.html: header section should also have id=header, same as other sections have. I didn't have time to test the changes to gluon/tools.py yet, I'll check out trunk a bit later... (note: edited to fix a typo in the code) Regards On Monday, February 24, 2014 9:40:22 AM UTC+1, Niphlod wrote: in my POV instead of reducing all alterations of default widgets in javascript we should ship new widget sets alltogether. This was discussed long ago but nobody seemed to care we can't really start supporting every css framework out there unless we change the way widgets are generated. Going bootstrap3 with this much FOUC is good for a plugin proof-of-concept but I'd not ship it as a scaffolding application... On Monday, February 24, 2014 7:12:22 AM UTC+1, Massimo Di Pierro wrote: Can we get rid of web2py-bootstrap3.js? Do we all these files? web2py.css bootstrap-responsive.min.css bootstrap-theme.min.css web2py-bootstrap3.css web2py_bootstrap.css web2py_bootstrap_nojs.css can we reduce to two: web2py.css web2py-bootstrap3.css On Monday, 24 February 2014 00:09:48 UTC-6, Massimo Di Pierro wrote: Added some of the missing files. They were created by Paolo but it was my mistake not to post them. They should address most of the issues. On Sunday, 23 February 2014 23:51:04 UTC-6, Ron McOuat wrote: I found this on Stack Overflow http://stackoverflow.com/questions/16214326/bootstrap-dropdown-with-hover ul.nav li.dropdown:hover ul.dropdown-menu { display: block; } and I find this solution using CSS in the .css file under welcome named static/css/web2py_bootstrap_nojs.css but not in any other css file. However this file is not included by another file anywhere in the welcome application. If this is it I just got lucky is all. :-) The Welcome application name header is scrunched up under the menu bar and partially visible lastest Firefox Ubuntu 12.04 LTS The web2py menu item (yellow) doesn't open like in 2.8.2 Ron -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving
[web2py] Javascript/Jquery after Form Validation?
I have a web2py form (sqlform.factory to be specific). After all the fields have been validated, I would like to call a javascript function using the form values as arguments. How can I do this? When I have a jquery event handler for the form submit, it gets called anytime the submit button is clicked, but I need something triggered only once all the fields have been validated. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: HELP with bootstrap 3
Both of these js's are commented out by default (note, the if sentence is commented out entirely), so it would work without internet connection. Anyway, for me it's ok either way... Pesonally, I don't use CDNs but I also prefer to have as few files in the welcome app as possible, especially if they are commented out. Regards On Monday, February 24, 2014 5:21:15 PM UTC+1, Niphlod wrote: I'm not confortable with having something cdn dependant. By default apps should be available also if no internet connectivity is assured. +1 with defaulting to local and a comment to enable the cdn version. On Monday, February 24, 2014 1:05:13 PM UTC+1, LightDot wrote: Note to those not reading this group from a web interface: I edited my post to fix copy paste typos in the code. This is the correct code again: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/ modernizr.min.js/script -- !--[if lt IE 9] script src=https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4. 2/respond.js/script ![endif]-- I apologize for the mix up. Regards On Monday, February 24, 2014 12:28:19 PM UTC+1, LightDot wrote: How about putting Paolo's bootstrap3.py into contrib an have welcome app import it from there? His module provides most of the bootstrap 3 support (forms, navigation, etc.). We could remove all this from core web2py. As for the welcome app static files, these are redundant (leftovers) now and should be deleted: static/css/bootstrap-responsive.min.css static/css/web2py_bootstrap.css static/css/web2py_bootstrap_nojs.css static/js/dd_belatedpng.js static/js/web2py_bootstrap.js This one is old (v3.0.3, should be v3.1.1): static/css/bootstrap-theme.min.css I think we should define modernizr.custom.js to use a CDN and remove it from the static files too, same as respond.js is defined now. I also think we should be suggesting users to use a free CDN instead of Maxcdn, so this should be in layout.html instead of what is now: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src= https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js;/script -- !--[if lt IE 9] script src= https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js /script ![endif]-- Another minor thing for the new layout.html: header section should also have id=header, same as other sections have. I didn't have time to test the changes to gluon/tools.py yet, I'll check out trunk a bit later... (note: edited to fix a typo in the code) Regards On Monday, February 24, 2014 9:40:22 AM UTC+1, Niphlod wrote: in my POV instead of reducing all alterations of default widgets in javascript we should ship new widget sets alltogether. This was discussed long ago but nobody seemed to care we can't really start supporting every css framework out there unless we change the way widgets are generated. Going bootstrap3 with this much FOUC is good for a plugin proof-of-concept but I'd not ship it as a scaffolding application... On Monday, February 24, 2014 7:12:22 AM UTC+1, Massimo Di Pierro wrote: Can we get rid of web2py-bootstrap3.js? Do we all these files? web2py.css bootstrap-responsive.min.css bootstrap-theme.min.css web2py-bootstrap3.css web2py_bootstrap.css web2py_bootstrap_nojs.css can we reduce to two: web2py.css web2py-bootstrap3.css On Monday, 24 February 2014 00:09:48 UTC-6, Massimo Di Pierro wrote: Added some of the missing files. They were created by Paolo but it was my mistake not to post them. They should address most of the issues. On Sunday, 23 February 2014 23:51:04 UTC-6, Ron McOuat wrote: I found this on Stack Overflow http://stackoverflow.com/questions/16214326/bootstrap-dropdown-with-hover ul.nav li.dropdown:hover ul.dropdown-menu { display: block; } and I find this solution using CSS in the .css file under welcome named static/css/web2py_bootstrap_nojs.css but not in any other css file. However this file is not included by another file anywhere in the welcome application. If this is it I just got lucky is all. :-) The Welcome application name header is scrunched up under the menu bar and partially visible lastest Firefox Ubuntu 12.04 LTS The
[web2py] Re: Javascript/Jquery after Form Validation?
Validation happens on the server, after the form has been submitted, so at that point it is too late to do anything on the original page in the browser. You could run some JS on the returned page after it loads, or put the form in an Ajax component and put some code in response.js to run when the submission response is returned. Hard to say without knowing in more detail what you're trying to do. Anthony On Monday, February 24, 2014 11:37:07 AM UTC-5, EW wrote: I have a web2py form (sqlform.factory to be specific). After all the fields have been validated, I would like to call a javascript function using the form values as arguments. How can I do this? When I have a jquery event handler for the form submit, it gets called anytime the submit button is clicked, but I need something triggered only once all the fields have been validated. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: HELP with bootstrap 3
I misunderstood you at first because I was looking at the modernizr too much. If the proposal is to put respond.js into static/js, and remove modernizr from it, than I'm +1 to that. !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use a local copy of modernizr.min.js, download it in static/js sub-folder and replace the script link in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/ modernizr.min.js/script -- !--[if lt IE 9] script src={{=URL('static','js/respond.js')}}/script -- ![endif]-- On Monday, February 24, 2014 5:21:15 PM UTC+1, Niphlod wrote: I'm not confortable with having something cdn dependant. By default apps should be available also if no internet connectivity is assured. +1 with defaulting to local and a comment to enable the cdn version. On Monday, February 24, 2014 1:05:13 PM UTC+1, LightDot wrote: Note to those not reading this group from a web interface: I edited my post to fix copy paste typos in the code. This is the correct code again: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/ modernizr.min.js/script -- !--[if lt IE 9] script src=https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4. 2/respond.js/script ![endif]-- I apologize for the mix up. Regards On Monday, February 24, 2014 12:28:19 PM UTC+1, LightDot wrote: How about putting Paolo's bootstrap3.py into contrib an have welcome app import it from there? His module provides most of the bootstrap 3 support (forms, navigation, etc.). We could remove all this from core web2py. As for the welcome app static files, these are redundant (leftovers) now and should be deleted: static/css/bootstrap-responsive.min.css static/css/web2py_bootstrap.css static/css/web2py_bootstrap_nojs.css static/js/dd_belatedpng.js static/js/web2py_bootstrap.js This one is old (v3.0.3, should be v3.1.1): static/css/bootstrap-theme.min.css I think we should define modernizr.custom.js to use a CDN and remove it from the static files too, same as respond.js is defined now. I also think we should be suggesting users to use a free CDN instead of Maxcdn, so this should be in layout.html instead of what is now: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src= https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js;/script -- !--[if lt IE 9] script src= https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js /script ![endif]-- Another minor thing for the new layout.html: header section should also have id=header, same as other sections have. I didn't have time to test the changes to gluon/tools.py yet, I'll check out trunk a bit later... (note: edited to fix a typo in the code) Regards On Monday, February 24, 2014 9:40:22 AM UTC+1, Niphlod wrote: in my POV instead of reducing all alterations of default widgets in javascript we should ship new widget sets alltogether. This was discussed long ago but nobody seemed to care we can't really start supporting every css framework out there unless we change the way widgets are generated. Going bootstrap3 with this much FOUC is good for a plugin proof-of-concept but I'd not ship it as a scaffolding application... On Monday, February 24, 2014 7:12:22 AM UTC+1, Massimo Di Pierro wrote: Can we get rid of web2py-bootstrap3.js? Do we all these files? web2py.css bootstrap-responsive.min.css bootstrap-theme.min.css web2py-bootstrap3.css web2py_bootstrap.css web2py_bootstrap_nojs.css can we reduce to two: web2py.css web2py-bootstrap3.css On Monday, 24 February 2014 00:09:48 UTC-6, Massimo Di Pierro wrote: Added some of the missing files. They were created by Paolo but it was my mistake not to post them. They should address most of the issues. On Sunday, 23 February 2014 23:51:04 UTC-6, Ron McOuat wrote: I found this on Stack Overflow http://stackoverflow.com/questions/16214326/bootstrap-dropdown-with-hover ul.nav li.dropdown:hover ul.dropdown-menu { display: block; } and I find this solution using CSS in the .css file under welcome named
Re: [web2py] Re: Web2py Integration with Multiple Oauth Logins
James, May I suggest we continue this discussion in the google code repo? You could create an issue with a link to this thread. Quint On Feb 23, 2014 10:21 PM, James Q james.quacine...@gmail.com wrote: Hello again, Thanks for taking your time to engage with me. Hopefully I can get this working sometime soon. Regarding the update, I re-cloned the repository and notied a w2p file there. I used this file to upload to the web2py admin interface, which gives me the same error as before. Are you saying that I need to extract it first, add my keys to it, and then try uploading it? Either way, I did it manually using tar and I get this traceback now, which is similar to the above: Traceback (most recent call last): File /home/james/Development/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/james/Development/web2py/applications/oauth/models/plugin_social_auth.py http://127.0.0.1/admin/edit/oauth/models/plugin_social_auth.py, line 7, in module Field('user', 'reference auth_user', writable=False, notnull=True)) File /home/james/Development/web2py/gluon/dal.py, line 8139, in define_table table = self.lazy_define_table(tablename,*fields,**args) File /home/james/Development/web2py/gluon/dal.py, line 8156, in lazy_define_table table = table_class(self, tablename, *fields, **args) File /home/james/Development/web2py/gluon/dal.py, line 8665, in __init__ check_reserved(field_name) File /home/james/Development/web2py/gluon/dal.py, line 7850, in check_reserved_keyword 'invalid table/column name %s is a %s reserved SQL/NOSQL keyword' % (name, backend.upper())) SyntaxError: invalid table/column name user is a ALL reserved SQL/NOSQL keyword Guess that needs to be changed as well :) -- James On Sat, Feb 22, 2014 at 3:41 AM, Quint muijsenbe...@gmail.com wrote: Hi, About the exception: I changed the Field name to oauth_uid. I did not notice this problem because i'm using GAE. About *App does not exist or you are not authorized*: This means that your oauth key/secret is not properly set in your configuration. You are not supplying a valid/authorized oauth client key to the provider. Which provider is giving this message? What does your configuration look like? What is find strange is that that plugin packed/installed by yourself is giving different result than te one installed manually. This should be exactly the same right? Are you sure everything is included in the one packed by yourself? Regards, Quint On Saturday, February 22, 2014 4:15:11 AM UTC+1, James Q wrote: Interesting plugin, thanks for the link. I took that repository, tar'ed and gzip'ed it, and uploaded it as a plugin. Says App does not exist or you are not authorized. No idea what that means, so I did it manually in a new app called oauth. Here is what I get as an exception when trying to open up the new app: Traceback (most recent call last): File /home/james/Development/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/james/Development/deemok-web2py/applications/oauth/models/plugin_social_auth.py http://127.0.0.1/admin/edit/oauth/models/plugin_social_auth.py, line 7, in module Field('user', 'reference auth_user', writable=False, notnull=True)) File /home/james/Development/web2py/gluon/dal.py, line 8139, in define_table table = self.lazy_define_table(tablename,*fields,**args) File /home/james/Development/web2py/gluon/dal.py, line 8156, in lazy_define_table table = table_class(self, tablename, *fields, **args) File /home/james/Development/web2py/gluon/dal.py, line 8665, in __init__ check_reserved(field_name) File /home/james/Development/web2py/gluon/dal.py, line 7850, in check_reserved_keyword 'invalid table/column name %s is a %s reserved SQL/NOSQL keyword' % (name, backend.upper())) SyntaxError: invalid table/column name uid is a ALL reserved SQL/NOSQL keyword Can you possibly rename the field: Field('uid', 'string', notnull=True, writable=False, length=255), to: Field('oauth_uid', 'string', notnull=True, writable=False, length=255), Or something along those lines? On Friday, February 21, 2014 3:55:00 AM UTC-5, Quint wrote: Hi, You could have a look at python-social-authhttps://github.com/omab/python-social-auth and if you like it and don't know how to integrate it, have a look at this plugin https://code.google.com/p/w2p-social-auth/ to integrate it in web2py. Quint On Wednesday, February 19, 2014 12:33:29 AM UTC+1, James Q wrote: I have a feeling that this topic comes up often, but I cannot seem to Google a good solution to this. Essentially, I want users to be able to login using either the built in Auth, or login via some Oauth provider, like Twitter and Facebook. I have seen previous solutions using ExtendedLoginForm and custom
[web2py] select rows having more than one item in list:string field
How do I write a query that selects rows having more than one item in list:string field? Assume I have a table definition db.define_table('sample_table', Field('tags', 'list:string'), ) How can I select rows that have more than one tag? Regards, -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: select rows having more than one item in list:string field
list:string field values are stored as simple strings with the items delimited by | characters (the values are converted to/from lists during the select/insert process on the web2py side). So, a value with one tag would like like |tag|, and a value with more than one tag would therefore have at least one additional | character in between the opening and closing |, which leads to the following query: db(db.sample_table.tags.like('|%|%|')).select() Note, that will also include records with a single tag if that single tag happens to include a | character within it (which presumably would be quite rare, if not prohibited). Anthony On Monday, February 24, 2014 1:44:39 PM UTC-5, Kök Eksi Bir wrote: How do I write a query that selects rows having more than one item in list:string field? Assume I have a table definition db.define_table('sample_table', Field('tags', 'list:string'), ) How can I select rows that have more than one tag? Regards, -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] pg8000 driver that comes with web2py 2.8.2 is not supporting JSON field type?
You could try to update pg8000 from the official: https://github.com/mfenniak/pg8000 Let us know if that works, so we could update the one distributed with web2py The one currently distributed in contrib is an older version with custom patches (as it was not being mantained at the time it was included to web2py), but now the official site has updates that could help you in this case. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, Feb 24, 2014 at 10:18 AM, Horst Horst spamfra...@gmail.com wrote: I'm getting a: class 'gluon.contrib.pg8000.errors.NotSupportedError' type oid 114 not mapped to py type I'm wondering what's the best thing to do now? Currently I'm considering: - using TEXT instead. But my former JSON strings are then enclosed by | which leads to new errors - updating gp8000 (there seems to be a newer version, but the version numbering is confusing) - using psycopg2. How can I install this into an Mac OS standalone version of web2py? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to pre filter a table I want to join.
I tried the below syntex. It works, throughs no errors but the list is not being filtered, (when selecting a value other than ALL): def filter_eco_graph(): my_graphs = db.t_tests_results.created_by == auth.user.id a = request.vars # just for testing and it renders what is expected. () graph_query = (my_graphs) if request.vars.platform != 'ALL': platform_query = db.t_types.id == request.vars.platform graph_query = graph_query (platform_query) if request.vars.project != 'ALL': project_query = db.t_projects.id == request.vars.project graph_query = graph_query (project_query) if request.vars.device != 'ALL': device_query = db.t_devices.id == request.vars.device graph_query = graph_query (device_query) if request.vars.milestone != 'ALL': milestone_query = db.t_milestones.id == request.vars.milestone graph_query = graph_query (milestone_query) if request.vars.env !='ALL': env_query = db.t_envs.id == request.vars.env graph_query = graph_query (env_query) graph_data = db(graph_query).select(join=db.t_tests.on(db. t_tests_results.f_test == db.t_tests.id)) return locals() On Monday, February 24, 2014 5:03:36 PM UTC+2, Avi A wrote: thanks, yes i just realised i don't need the joint for the filtering. On Monday, February 24, 2014 4:57:37 PM UTC+2, Anthony wrote: t_b = db.t_b.f_x ==3 Doesn't look like you do anything with the above. Why not: rows = db((db.t_a.created_by == auth.user.id) (db.t_b.f_x == 3)).select ( join=db.t_b.on(db.t_a.f_test == db.t_b.id)) Note, you can also do a join via: rows = db((db.t_a.created_by == auth.user.id) (db.t_b.f_x == 3) (db.t_a.f_test == db.t_b.id)).select() Technically, that will implement the join via a SQL WHERE clause rather than the JOIN statement. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to pre filter a table I want to join.
I'll try to filter the t_tests only first. On Monday, February 24, 2014 4:51:31 PM UTC+2, Avi A wrote: Hi, I want to join t_a and t_b: rows = db(db.t_a.created_by == auth.user.id).select(join=db.t_b.on(db.t_a.f_y == db.t_b.id)) that works, But first I want to filter out t_b, for example: t_b to include only records where f_x == 3. what I tried did not work, it just ignored it, nothing was filtered: t_b = db.t_b.f_x ==3 rows = db(db.t_a.created_by == auth.user.id).select(join=db.t_b.on(db.t_a.f_test == db.t_b.id)) So what is the way to do it? thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: HELP with bootstrap 3
Can you elaborate on the pros and cons? On Monday, 24 February 2014 12:31:12 UTC-6, LightDot wrote: I misunderstood you at first because I was looking at the modernizr too much. If the proposal is to put respond.js into static/js, and remove modernizr from it, than I'm +1 to that. !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use a local copy of modernizr.min.js, download it in static/js sub-folder and replace the script link in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/ modernizr.min.js/script -- !--[if lt IE 9] script src={{=URL('static','js/respond.js')}}/script -- ![endif]-- On Monday, February 24, 2014 5:21:15 PM UTC+1, Niphlod wrote: I'm not confortable with having something cdn dependant. By default apps should be available also if no internet connectivity is assured. +1 with defaulting to local and a comment to enable the cdn version. On Monday, February 24, 2014 1:05:13 PM UTC+1, LightDot wrote: Note to those not reading this group from a web interface: I edited my post to fix copy paste typos in the code. This is the correct code again: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src=https://cdnjs.cloudflare. com/ajax/libs/modernizr/2.7.1/modernizr.min.js/script -- !--[if lt IE 9] script src=https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4. 2/respond.js/script ![endif]-- I apologize for the mix up. Regards On Monday, February 24, 2014 12:28:19 PM UTC+1, LightDot wrote: How about putting Paolo's bootstrap3.py into contrib an have welcome app import it from there? His module provides most of the bootstrap 3 support (forms, navigation, etc.). We could remove all this from core web2py. As for the welcome app static files, these are redundant (leftovers) now and should be deleted: static/css/bootstrap-responsive.min.css static/css/web2py_bootstrap.css static/css/web2py_bootstrap_nojs.css static/js/dd_belatedpng.js static/js/web2py_bootstrap.js This one is old (v3.0.3, should be v3.1.1): static/css/bootstrap-theme.min.css I think we should define modernizr.custom.js to use a CDN and remove it from the static files too, same as respond.js is defined now. I also think we should be suggesting users to use a free CDN instead of Maxcdn, so this should be in layout.html instead of what is now: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src= https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js;/script -- !--[if lt IE 9] script src= https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js /script ![endif]-- Another minor thing for the new layout.html: header section should also have id=header, same as other sections have. I didn't have time to test the changes to gluon/tools.py yet, I'll check out trunk a bit later... (note: edited to fix a typo in the code) Regards On Monday, February 24, 2014 9:40:22 AM UTC+1, Niphlod wrote: in my POV instead of reducing all alterations of default widgets in javascript we should ship new widget sets alltogether. This was discussed long ago but nobody seemed to care we can't really start supporting every css framework out there unless we change the way widgets are generated. Going bootstrap3 with this much FOUC is good for a plugin proof-of-concept but I'd not ship it as a scaffolding application... On Monday, February 24, 2014 7:12:22 AM UTC+1, Massimo Di Pierro wrote: Can we get rid of web2py-bootstrap3.js? Do we all these files? web2py.css bootstrap-responsive.min.css bootstrap-theme.min.css web2py-bootstrap3.css web2py_bootstrap.css web2py_bootstrap_nojs.css can we reduce to two: web2py.css web2py-bootstrap3.css On Monday, 24 February 2014 00:09:48 UTC-6, Massimo Di Pierro wrote: Added some of the missing files. They were created by Paolo but it was my mistake not to post them. They should address most of the issues. On Sunday, 23 February 2014 23:51:04 UTC-6, Ron McOuat wrote: I found this on Stack Overflow http://stackoverflow.com/questions/16214326/bootstrap-dropdown-with-hover ul.nav li.dropdown:hover
[web2py] Re: How to pre filter a table I want to join.
Yep, this way it work: if request.vars.platform != 'ALL': platform_query = db.t_tests.f_test_platform == request.vars.platform graph_query = graph_query (platform_query) if request.vars.project != 'ALL': project_query = db.t_tests.f_test_project == request.vars.project graph_query = graph_query (project_query) if request.vars.device != 'ALL': device_query = db.t_tests.f_test_device == request.vars.device graph_query = graph_query (device_query) if request.vars.milestone != 'ALL': milestone_query = db.t_tests.f_test_milestone == request.vars.milestone graph_query = graph_query (milestone_query) if request.vars.env !='ALL': env_query = db.t_tests.f_tests_env == request.vars.env graph_query = graph_query (env_query) Many thanks. :). On Monday, February 24, 2014 4:51:31 PM UTC+2, Avi A wrote: Hi, I want to join t_a and t_b: rows = db(db.t_a.created_by == auth.user.id).select(join=db.t_b.on(db.t_a.f_y == db.t_b.id)) that works, But first I want to filter out t_b, for example: t_b to include only records where f_x == 3. what I tried did not work, it just ignored it, nothing was filtered: t_b = db.t_b.f_x ==3 rows = db(db.t_a.created_by == auth.user.id).select(join=db.t_b.on(db.t_a.f_test == db.t_b.id)) So what is the way to do it? thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Represent: List indexing problem.
I am parsing data out of files and inputting this data into a sqlite db. One file may have multiple username entries. The data looks something like this: [['tom', 324],['dick', 246],['harry', 112]] The first item in each list is obviously the name. The second line is the line number (i used enumerate) from my parsed file. I want to be able to display html like follows: Line: 324 - tom Line: 246 - dick Line: 112 - harry I'd like to be able to access items in my lists by index; however, everything inside my individual lists are strings. Do I have to convert the strings back to a list? Example: The following returns ['tom', 324] Field('username', represent = lambda x, row: x[0]), While this returns '[' Field('username', represent = lambda x, row: x[0][0]), I'd rather not have to convert every line back into a listis there a better way to do this? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Date display i18n internationalization?
I added T.current_languages = [] to the end of my model but this did nothing. Then I tried: T.current_languages = [] T.force('en-us') This caused the translated string in en-us.py to show up in the rendered html (and also caused the filling of en-us.py with default strings). However, I still don't seem to have a solution, because I don't want to force the language to be en-us. I want to use whatever the user's accept-language is. And in general this already works, except for en-us. Thoughts? On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote: I get it now. You need: T.current_languages = [] Otherwise this is set to T.current_languages = ['en'] and it things the current language is english and therefore it does not need translation. On Monday, 24 February 2014 01:45:49 UTC-6, User wrote: In fact, if I put an entry in en-gb.py and set my browser accept-language to en-gb it will correctly pick up this string, but for some reason it's not picking up the string in en-us (unless I'm doing something wrong). Also interesting to note, is when I view my site with en-gb or es as the accept lang, web2py seems to automatically modify the en-gb.py and es.py files with default entries for every default string, whereas it's not doing that for en-us.py Does this have to with en-us.py being a default or something? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Date display i18n internationalization?
Ok. One more try: T.set_current_languages() On Monday, 24 February 2014 17:36:10 UTC-6, User wrote: I added T.current_languages = [] to the end of my model but this did nothing. Then I tried: T.current_languages = [] T.force('en-us') This caused the translated string in en-us.py to show up in the rendered html (and also caused the filling of en-us.py with default strings). However, I still don't seem to have a solution, because I don't want to force the language to be en-us. I want to use whatever the user's accept-language is. And in general this already works, except for en-us. Thoughts? On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote: I get it now. You need: T.current_languages = [] Otherwise this is set to T.current_languages = ['en'] and it things the current language is english and therefore it does not need translation. On Monday, 24 February 2014 01:45:49 UTC-6, User wrote: In fact, if I put an entry in en-gb.py and set my browser accept-language to en-gb it will correctly pick up this string, but for some reason it's not picking up the string in en-us (unless I'm doing something wrong). Also interesting to note, is when I view my site with en-gb or es as the accept lang, web2py seems to automatically modify the en-gb.py and es.py files with default entries for every default string, whereas it's not doing that for en-us.py Does this have to with en-us.py being a default or something? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Date display i18n internationalization?
This does not appear to work the string is not translated. Also the following doesn't work either: T.set_current_languages() T.force('en-us') However, as mentioned above changing this back to: T.current_languages = [] T.force('en-us') Does work On Monday, February 24, 2014 6:45:18 PM UTC-5, Massimo Di Pierro wrote: Ok. One more try: T.set_current_languages() On Monday, 24 February 2014 17:36:10 UTC-6, User wrote: I added T.current_languages = [] to the end of my model but this did nothing. Then I tried: T.current_languages = [] T.force('en-us') This caused the translated string in en-us.py to show up in the rendered html (and also caused the filling of en-us.py with default strings). However, I still don't seem to have a solution, because I don't want to force the language to be en-us. I want to use whatever the user's accept-language is. And in general this already works, except for en-us. Thoughts? On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote: I get it now. You need: T.current_languages = [] Otherwise this is set to T.current_languages = ['en'] and it things the current language is english and therefore it does not need translation. On Monday, 24 February 2014 01:45:49 UTC-6, User wrote: In fact, if I put an entry in en-gb.py and set my browser accept-language to en-gb it will correctly pick up this string, but for some reason it's not picking up the string in en-us (unless I'm doing something wrong). Also interesting to note, is when I view my site with en-gb or es as the accept lang, web2py seems to automatically modify the en-gb.py and es.py files with default entries for every default string, whereas it's not doing that for en-us.py Does this have to with en-us.py being a default or something? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Represent: List indexing problem.
I solved this by inserting the data as json. This line now returns '324'. Field('username', represent = lambda x, row: x[0][1]), -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Using Recaptcha
I'm trying to use Recaptcha. I'm following the instructions given here: http://www.web2py.com/book/default/chapter/09#CAPTCHA-and-reCAPTCHA However, when I try to execute the form, I get this error: type 'exceptions.AttributeError' 'NoneType' object has no attribute 'env' Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/www-data/web2py/applications/miramar_contact/controllers/default.py https://67.213.70.251/admin/default/edit/miramar_contact/controllers/default.py, line 111, in module File /home/www-data/web2py/gluon/globals.py, line 372, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/miramar_contact/controllers/default.py https://67.213.70.251/admin/default/edit/miramar_contact/controllers/default.py, line 41, in index TR(T('Enter what you see:'),Recaptcha(public_key='6LcRI-8SAAwNGmVIDpB_E45iurpVd7Mh5H2g',private_key='6LcRI-8SAHJon4JWF6nAErt_B4kEy-lXBxH5',use_ssl=True,error_message='invalid',label='Verify:',options='')), File /home/www-data/web2py/gluon/tools.py, line 757, in __init__ self.remote_addr = request.env.remote_addr AttributeError: 'NoneType' object has no attribute 'env' I followed the instructions to the letter. I inserted the following in my form: Recaptcha(public_key='my public key',private_key='my private key',use_ssl=True,error_message='invalid',label='Verify:',options='') I don't know what I'm missing. Is the web2py book missing something, too? Methinks it is. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: HELP with bootstrap 3
Modernizr and Respond are not interchangeable. Modernizr detects detailed browser capabilities and makes conditional JS/CSS programming possible, while Respond adds the support for certain CSS3 media queries to older browsers (IE 6-8), thus enabling them to display responsive designs. Bootstrap 3 won't work on IE8 or older browsers without the Respond library (or some other similar lib - there are others, but Respond is small and fast). Direct link to the minified version from the author: https://raw.github.com/scottjehl/Respond/master/dest/respond.min.js I'm not opposed to keeping modernizr in static/js if others think that it's still needed. I don't use it and since it's commented out in Paolo's layout, I vote for removal and a comment, suggesting to users that it exists... !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use a local copy of modernizr.min.js download it in static/js sub-folder and replace the script link in the following conditional comment with script src={{=URL('static','js/modernizr.min.js')}}/script -- !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js;/script -- !--[if lt IE 9] script src={{=URL('static','js/respond.min.js')}}/script ![endif]-- Regards On Monday, February 24, 2014 10:04:31 PM UTC+1, Massimo Di Pierro wrote: Can you elaborate on the pros and cons? On Monday, 24 February 2014 12:31:12 UTC-6, LightDot wrote: I misunderstood you at first because I was looking at the modernizr too much. If the proposal is to put respond.js into static/js, and remove modernizr from it, than I'm +1 to that. !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use a local copy of modernizr.min.js, download it in static/js sub-folder and replace the script link in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script !-- script src=https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/ modernizr.min.js/script -- !--[if lt IE 9] script src={{=URL('static','js/respond.js')}}/script -- ![endif]-- On Monday, February 24, 2014 5:21:15 PM UTC+1, Niphlod wrote: I'm not confortable with having something cdn dependant. By default apps should be available also if no internet connectivity is assured. +1 with defaulting to local and a comment to enable the cdn version. On Monday, February 24, 2014 1:05:13 PM UTC+1, LightDot wrote: Note to those not reading this group from a web interface: I edited my post to fix copy paste typos in the code. This is the correct code again: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src=https://cdnjs.cloudflare. com/ajax/libs/modernizr/2.7.1/modernizr.min.js/script -- !--[if lt IE 9] script src=https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4. 2/respond.js/script ![endif]-- I apologize for the mix up. Regards On Monday, February 24, 2014 12:28:19 PM UTC+1, LightDot wrote: How about putting Paolo's bootstrap3.py into contrib an have welcome app import it from there? His module provides most of the bootstrap 3 support (forms, navigation, etc.). We could remove all this from core web2py. As for the welcome app static files, these are redundant (leftovers) now and should be deleted: static/css/bootstrap-responsive.min.css static/css/web2py_bootstrap.css static/css/web2py_bootstrap_nojs.css static/js/dd_belatedpng.js static/js/web2py_bootstrap.js This one is old (v3.0.3, should be v3.1.1): static/css/bootstrap-theme.min.css I think we should define modernizr.custom.js to use a CDN and remove it from the static files too, same as respond.js is defined now. I also think we should be suggesting users to use a free CDN instead of Maxcdn, so this should be in layout.html instead of what is now: !-- All JavaScript at the bottom, except for Modernizr and Respond If you need to use local copies of modernizr.min.js or respond.js download them in static/js sub-folder and replace the script links in the following conditional comments with script src={{=URL('static','js/modernizr.min.js')}}/script script src={{=URL('static','js/respond.js')}}/script -- !-- script src= https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js;/script -- !--[if lt IE 9] script src= https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js /script ![endif]-- Another minor thing for the new layout.html: header section should also have id=header, same as other sections have. I didn't have time to
[web2py] Formatting JSON objects with XML() -TypeError: gluon.html.XML object xxxx is not JSON serializable
I have json data that looks like this: [['tom', 324],['dick', 246],['harry', 112]] I want to be able to display html like follows: Line: 324 - tom Line: 246 - dick Line: 112 - harry SoI made a function to reformat my data and use represent to run the data through the function: Field('username', 'json', represent = lambda usernames, row: displayrecords( usernames)), Here is the function: def displayrecords(value): values = [] for x, y in value: values.append(str('Line: '+ str(y) + ' ~ ' + x)) return values This function then give me a list as follows: ['Line: 324 ~ tom', 'Line: 246 ~ dick', 'Line: 112 ~ harry'] Now, whenever I change the field line to this Field('username', 'json', represent = lambda usernames, row: XML('br'.join(displayrecords(usernames, I get the following traceback: Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Traceback (most recent call last): File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/restricted.py, line 217, in restricted File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/applications/Contour/controllers/devices2.py http://127.0.0.1:8000/admin/default/edit/Contour/controllers/devices2.py, line 214, in module File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/globals.py, line 372, in lambda File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/applications/Contour/controllers/devices2.py http://127.0.0.1:8000/admin/default/edit/Contour/controllers/devices2.py, line 47, in list2 File applications/Contour/modules/engine5.py, line 395, in show_settings File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/sqlhtml.py, line 2473, in grid File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/dal.py, line 9921, in formatter File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/validators.py, line 2681, in formatter File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/validators.py, line 369, in formatter File json/__init__.pyc, line 231, in dumps File json/encoder.pyc, line 201, in encode File json/encoder.pyc, line 264, in iterencode File json/encoder.pyc, line 178, in default TypeError: gluon.html.XML object at 0x10fecc190 is not JSON serializable Where am I going wrong here? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Formatting JSON objects with XML() -TypeError: gluon.html.XML object xxxx is not JSON serializable
What exactly produced that error, and can you show the rest of the traceback details? On Monday, February 24, 2014 10:04:09 PM UTC-5, Brando wrote: I have json data that looks like this: [['tom', 324],['dick', 246],['harry', 112]] I want to be able to display html like follows: Line: 324 - tom Line: 246 - dick Line: 112 - harry SoI made a function to reformat my data and use represent to run the data through the function: Field('username', 'json', represent = lambda usernames, row:displayrecords (usernames)), Here is the function: def displayrecords(value): values = [] for x, y in value: values.append(str('Line: '+ str(y) + ' ~ ' + x)) return values This function then give me a list as follows: ['Line: 324 ~ tom', 'Line: 246 ~ dick', 'Line: 112 ~ harry'] Now, whenever I change the field line to this Field('username', 'json', represent = lambda usernames, row: XML('br'.join(displayrecords(usernames, I get the following traceback: Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Traceback (most recent call last): File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/restricted.py, line 217, in restricted File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/applications/Contour/controllers/devices2.py http://127.0.0.1:8000/admin/default/edit/Contour/controllers/devices2.py, line 214, in module File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/globals.py, line 372, in lambda File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/applications/Contour/controllers/devices2.py http://127.0.0.1:8000/admin/default/edit/Contour/controllers/devices2.py, line 47, in list2 File applications/Contour/modules/engine5.py, line 395, in show_settings File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/sqlhtml.py, line 2473, in grid File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/dal.py, line 9921, in formatter File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/validators.py, line 2681, in formatter File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/validators.py, line 369, in formatter File json/__init__.pyc, line 231, in dumps File json/encoder.pyc, line 201, in encode File json/encoder.pyc, line 264, in iterencode File json/encoder.pyc, line 178, in default TypeError: gluon.html.XML object at 0x10fecc190 is not JSON serializable Where am I going wrong here? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] simple count(*) field in SQLFORM.grid
I'm trying to transliterate this sql into web2py: select g.name, p.status, count(*) from garden g join plot p on g.id = p.garden_id group by g.name, p.status order by g.name; Given this model: db.define_table('garden', Field('name',requires=[IS_NOT_EMPTY()]), Field('status')) db.define_table('plot', Field('garden_id','reference garden'), Field('name',requires=[IS_NOT_EMPTY()]), Field('status')) I can't see from the doco how to add the count(*) field to the select list: grid=SQLFORM.grid(db.garden, fields=[db.garden.name,db.plot.status], headers={'garden.name':'Garden', 'plot.status':'Plot(s) Status'}, left=db.garden.on(db.garden.id==db.plot.garden_id), orderby=db.garden.name|db.plot.name, groupby=db.garden.name|db.plot.status) Thanks! Don -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Using Recaptcha
Include request in the parameters, and see if that works. Recaptcha(request, ) Kiran Subbaraman http://subbaraman.wordpress.com/about/ On Tue, 25-02-2014 6:40 AM, horridohobbyist wrote: I'm trying to use Recaptcha. I'm following the instructions given here: http://www.web2py.com/book/default/chapter/09#CAPTCHA-and-reCAPTCHA However, when I try to execute the form, I get this error: type 'exceptions.AttributeError' 'NoneType' object has no attribute 'env' Traceback(most recent call last): File/home/www-data/web2py/gluon/restricted.py,line217,inrestricted execccodeinenvironment File/home/www-data/web2py/applications/miramar_contact/controllers/default.py https://67.213.70.251/admin/default/edit/miramar_contact/controllers/default.py,line111,inmodule File/home/www-data/web2py/gluon/globals.py,line372,inlambda self._caller=lambdaf:f() File/home/www-data/web2py/applications/miramar_contact/controllers/default.py https://67.213.70.251/admin/default/edit/miramar_contact/controllers/default.py,line41,inindex TR(T('Enter what you see:'),Recaptcha(public_key='6LcRI-8SAAwNGmVIDpB_E45iurpVd7Mh5H2g',private_key='6LcRI-8SAHJon4JWF6nAErt_B4kEy-lXBxH5',use_ssl=True,error_message='invalid',label='Verify:',options='')), File/home/www-data/web2py/gluon/tools.py,line757,in__init__ self.remote_addr=request.env.remote_addr AttributeError:'NoneType'object has no attribute'env' I followed the instructions to the letter. I inserted the following in my form: Recaptcha(public_key='my public key',private_key='my private key',use_ssl=True,error_message='invalid',label='Verify:',options='') I don't know what I'm missing. Is the web2py book missing something, too? Methinks it is. Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: REF: Issue with uploading files with web2py
Hi again, I have found out as follows after twiking with the dhtmlx framework. I am not sure how o access the actual image, i have noticed the file is an instance of something...not a file per say. i have the following results: print type(file) type: type 'instance' print dir(file) dir: ['FieldStorageClass', '_FieldStorage__file', '_FieldStorage__write', '__contains__', '__doc__', '__getattr__', '__getitem__', '__init__', '__iter__', '__len__', '__module__', '__nonzero__', '__repr__', 'bufsize', 'disposition', 'disposition_options', 'done', 'file', 'filename', 'fp', 'getfirst', 'getlist', 'getvalue', 'has_key', 'headers', 'innerboundary', 'keep_blank_values', 'keys', 'length', 'list', 'make_file', 'name', 'outerboundary', 'qs_on_post', 'read_binary', 'read_lines', 'read_lines_to_eof', 'read_lines_to_outerboundary', 'read_multi', 'read_single', 'read_urlencoded', 'skip_lines', 'strict_parsing', 'type', 'type_options'] print file file: FieldStorage('file', 'power.gif', 'GIF87a\x1f\x02c\x01w\x00\x00!\xfe\x1aSoftware: Microsoft Office\x00,\x00\x00\x00\x00\x1f\x02c\x01\x87\xf7\xde{\xff\xef\xa5\xef\xbdZ\xf7\xd6s\xf7\xce{\xff\xe6\x94\xe6\xbdZ\xe6\xb5Z\xef\xc5Z\xde\xbdk\xf7\xe6\x94\xf7\xe6{\xff\xf7\xb5\xf7\xcek\xef\xbdk\xd6\x9cR\xf7\xd6\x8c\xb5{!\xe6\x9cB\xd6\xadZ\xef\xcek\xef\xb5Z\xef\xadJ\xd6\x9c1\xff\.etc...too long to display I looked at the PHP implementation which looks as follows: $filename = $_FILES[file][name]; move_uploaded_file($_FILES[file][tmp_name], uploaded/.$filename); What would be the equivalent in python? On Mon, Feb 24, 2014 at 4:41 PM, Teddy Nyambe software@gmail.comwrote: Ok let me check will revert at least you have given me a head start! On 24 Feb 2014 16:27, Anthony abasta...@gmail.com wrote: Well, it's just a string, so that's not the file. You have to figure out how the JS library is sending the file to the server. On Monday, February 24, 2014 9:18:32 AM UTC-5, software.ted wrote: What am supposed to see in dir and type? So that I can debug On 24 Feb 2014 16:16, Anthony abas...@gmail.com wrote: You'll have the check the JS framework docs to see how/where it is posting the file (e.g., maybe via a separate Ajax request). On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote: the output is: Dir: ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'] type: type 'str' On Mon, Feb 24, 2014 at 3:40 PM, Anthony abas...@gmail.com wrote: The output of type(request.vars.photo) and dir(request.vars.photo). On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote: I am using dhtmlx (www.dhtmlx.com) framework. The component am using is dhtmlxform. I don't understand what you mean by class and attribute. On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote: Can you provide information about the form processing tool? What is the class and attributes of request.vars.photo? Anthony On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: Am using form processing tool. Which has a send method...what it actually does is make post/get to a url in the form.send({{=URL('c','a')}}) So what happens in the controller is that I can access the form variables as follows: def a(): file_name = request.vars.file_name The framework has code examples of how to access the uploaded file in php and java Any ideas? On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote: Ajax doesn't allow file uploads in forms. Are you using an Ajax file upload widget on the client side? Anthony On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...:
[web2py] Re: Date display i18n internationalization?
For now do this: T.current_languages = [] T.force(T.http_accept_language) This should work. I will try figure out why T.set_current_languages() does not. On Monday, 24 February 2014 18:07:40 UTC-6, User wrote: This does not appear to work the string is not translated. Also the following doesn't work either: T.set_current_languages() T.force('en-us') However, as mentioned above changing this back to: T.current_languages = [] T.force('en-us') Does work On Monday, February 24, 2014 6:45:18 PM UTC-5, Massimo Di Pierro wrote: Ok. One more try: T.set_current_languages() On Monday, 24 February 2014 17:36:10 UTC-6, User wrote: I added T.current_languages = [] to the end of my model but this did nothing. Then I tried: T.current_languages = [] T.force('en-us') This caused the translated string in en-us.py to show up in the rendered html (and also caused the filling of en-us.py with default strings). However, I still don't seem to have a solution, because I don't want to force the language to be en-us. I want to use whatever the user's accept-language is. And in general this already works, except for en-us. Thoughts? On Monday, February 24, 2014 8:17:24 AM UTC-5, Massimo Di Pierro wrote: I get it now. You need: T.current_languages = [] Otherwise this is set to T.current_languages = ['en'] and it things the current language is english and therefore it does not need translation. On Monday, 24 February 2014 01:45:49 UTC-6, User wrote: In fact, if I put an entry in en-gb.py and set my browser accept-language to en-gb it will correctly pick up this string, but for some reason it's not picking up the string in en-us (unless I'm doing something wrong). Also interesting to note, is when I view my site with en-gb or es as the accept lang, web2py seems to automatically modify the en-gb.py and es.py files with default entries for every default string, whereas it's not doing that for en-us.py Does this have to with en-us.py being a default or something? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: REF: Issue with uploading files with web2py
$filename = $_FILES[file][name]; move_uploaded_file($_FILES[file][tmp_name], uploaded/.$filename); would be: import shutil, os filename = request.post_vars.file.filename shutil.copyfileobj(request.post_vars.file.file, open(os.path.join(uploaded,filename),'w')) This is very UNSAFE (both in python/web2py and in PHP). It can be used by the user to overwrite almost any file on the filesystem. The filename has to be sanitized. On Monday, 24 February 2014 01:35:02 UTC-6, software.ted wrote: I am extremely stuck on how to manage uploaded file, I have been working with web2py now for over a year and I like its flexibility, I have been working on an application that is ajax based using my own file. Now i have the following scenario i need help with: DB === db.create_table(person, Field(first_name), Field(photo, upload), ...) Controller: def manage_person(): try: value = db.person.update_or_insert(id == request.vars.id, first_name=request.vars.first_name, photo=request.vars.photo, ...) except ...: return value Now my question is how do i move the upaded image to say the upload folder, i was thinking web2py will put the physical image in upload folder according to documentation but unfortunately folder is empty. The DB hower gets updated with a the following: C:\fakepath\.jpg. Any ideas? Kind regards, -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Jquery Mobile
Hi all, I am using jquerymobile on a web2py test application and I realize that the response.flash notifications can not be closed or dismissed. I checked the layout.html in jquery_plugin and it does include web2py_ajax.html which includes web2py.js, but the notifications don't work as desired. Has anyone faced or solved this same problem? I will appreciate any help. Thanks, Clara -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Another multiple file upload and file drop area demo, this time using dropzone.js
Just what I was looking for :) Thanks! PS! I had to update dropzone.js to make it work with Chrome. Regards Morten On Monday, December 16, 2013 7:21:01 PM UTC+1, Leonel Câmara wrote: I did this to see how I could integrate dropzone.js ( http://www.dropzonejs.com/ ) with web2py as I'm thinking of using it in some of my projects. Hopefuly it can be useful to someone else. In this demo you have: - drop files in an area of the page to upload them. - CSFR protection (if someone could validate it, that'd be great, I'm no security expert). - Fallback html form working along side dropzone. - List files the user already uploaded, interact with them the same way you do with files you have just uploaded. - Delete files. - Thumbnails. - Demonstration of how to compute filesize of an upload. - Uploads progress bar. Any comments, or bug reports, you guys may make are appreciated and welcomed. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Multiple tables: update/insert/delete: in one form
Have you switched over from VFP to web2py? If so I would like to take your guidance for a similar data intensive app. On Monday, May 30, 2011 9:25:01 PM UTC+5:30, Vineet wrote: Can anybody toss his/her ideas on my code given in the previous post? ---Vineet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Auth with multiple E-mail addresses
Thank you for your answers. I think at this point my best option is to rewrite a class inheriting from Auth. If it works well I can publish it and we can discuss if it might be interesting to merge it to the trunk. Le dimanche 23 février 2014 04:41:24 UTC-5, mweissen a écrit : I think a new class could do the job. You could modify your db.py Replace auth = Auth(db, hmac_key=Auth.get_or_create_key()) by class MyAuth(Auth): # your code pass auth = MyAuth(db, hmac_key=Auth.get_or_create_key()) Regards, Martin 2014-02-23 0:21 GMT+01:00 Damien bardon...@gmail.com javascript:: I would like to associate to my users multiple E-mail addresses and phone numbers. I would like these users to be able to authenticate with any (verified) E-mail address or phone number. I am wondering what would be the best approach to achieve this. One idea would be to modify the existing Auth class. I am willing to do it, but I would like to know if this is something that could then potentially be merged in the main branch of web2py (any one else interested in this feature?). If not, this approach might not work as I don't want to maintain an alternate version of Auth that would diverge from the one integrated in web2py. Thank you for your suggestions. Damien -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to use twitter bootstrap style
How do you add the data toggle, data target, etc. as well? For example: form.element(_type='submit')(['_class']='btn btn-default',['_data-toggle']='modal',['_data-target']='.bs-example-modal-lg') but that doesn't work... On Friday, July 6, 2012 12:06:30 PM UTC-5, Annet wrote: To change the value of a button, this should work: form.element(_type='submit')['_value']='Login' To add the info button: form[0][-1][1].append(INPUT(_type=button,_value=Info,_onclick=document.location='%s' %URL('function'))) To add the classes: form.element(_type='submit')['_class']='btn btn-primary' form.element(_type='button')['_class']='btn btn-info' Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Formatting JSON objects with XML() -TypeError: gluon.html.XML object xxxx is not JSON serializable
Anthony, that error is produced when I change the field line like i show above. I basically need to know how to change this list: ['Line: 324 ~ tom', 'Line: 246 ~ dick', 'Line: 112 ~ harry'] into this html: Line: 324 - tom Line: 246 - dick Line: 112 - harry The problem seems to arise when I try to use XML() with a json object. I'm trying to add a br in between each item in the list, but XML() doesn't seem to play well with JSON. How could I accomplish this? On Monday, February 24, 2014 7:19:28 PM UTC-8, Anthony wrote: What exactly produced that error, and can you show the rest of the traceback details? On Monday, February 24, 2014 10:04:09 PM UTC-5, Brando wrote: I have json data that looks like this: [['tom', 324],['dick', 246],['harry', 112]] I want to be able to display html like follows: Line: 324 - tom Line: 246 - dick Line: 112 - harry SoI made a function to reformat my data and use represent to run the data through the function: Field('username', 'json', represent = lambda usernames, row:displayrecords (usernames)), Here is the function: def displayrecords(value): values = [] for x, y in value: values.append(str('Line: '+ str(y) + ' ~ ' + x)) return values This function then give me a list as follows: ['Line: 324 ~ tom', 'Line: 246 ~ dick', 'Line: 112 ~ harry'] Now, whenever I change the field line to this Field('username', 'json', represent = lambda usernames, row: XML('br'.join(displayrecords(usernames, I get the following traceback: Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. Traceback (most recent call last): File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/restricted.py, line 217, in restricted File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/applications/Contour/controllers/devices2.py http://127.0.0.1:8000/admin/default/edit/Contour/controllers/devices2.py, line 214, in module File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/globals.py, line 372, in lambda File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/applications/Contour/controllers/devices2.py http://127.0.0.1:8000/admin/default/edit/Contour/controllers/devices2.py, line 47, in list2 File applications/Contour/modules/engine5.py, line 395, in show_settings File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/sqlhtml.py, line 2473, in grid File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/dal.py, line 9921, in formatter File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/validators.py, line 2681, in formatter File /Volumes/BrandonsData/Google Drive/web2py/web2py.app/Contents/Resources/gluon/validators.py, line 369, in formatter File json/__init__.pyc, line 231, in dumps File json/encoder.pyc, line 201, in encode File json/encoder.pyc, line 264, in iterencode File json/encoder.pyc, line 178, in default TypeError: gluon.html.XML object at 0x10fecc190 is not JSON serializable Where am I going wrong here? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.