[web2py] Problem with Date when sending e-mails
Hi! I use mail.send() to notify users about events in a (german) web2py application. Unfortunately, the header of the e-mail contains Date: Di, 25 Feb 2014 08:13:08 + instead of Date: Tue, 25 Feb 2014 08:13:08 + and e-mail readers show January 1, 1970 as its date since they cannot interpret the localized date. How can I fix this? Adding a header line with a correct formatted date leads into an e-mail having two Date-lines in the header which doesn't help. Sincerely, Jochen -- 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
Ok great this is smooth!!! thumbs up to python+web2py!!! On Tue, Feb 25, 2014 at 8:00 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: $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. -- ... 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] Re: Formatting JSON objects with XML() -TypeError: gluon.html.XML object xxxx is not JSON serializable
Sorry...This should have read: Line: 324 ~ tom Line: 246 ~ dick Line: 112 ~ harry also, I am displaying this info in a SQLFORM.grid -- 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: Problem with Date when sending e-mails
Solved with this workaround: https://groups.google.com/forum/#!topic/web2py/JOX2YIPE8D8 But is there a better or cleaner way? And why is that workaround not part of the current release of web2py? Sincerely, Jochen Am Dienstag, 25. Februar 2014 09:16:58 UTC+1 schrieb Jochen Schoenfeld: Hi! I use mail.send() to notify users about events in a (german) web2py application. Unfortunately, the header of the e-mail contains Date: Di, 25 Feb 2014 08:13:08 + instead of Date: Tue, 25 Feb 2014 08:13:08 + and e-mail readers show January 1, 1970 as its date since they cannot interpret the localized date. How can I fix this? Adding a header line with a correct formatted date leads into an e-mail having two Date-lines in the header which doesn't help. Sincerely, Jochen -- 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: Problem with Date when sending e-mails
I think this is actually a bug in web2py because the SMTP standard says the day of the week, if included, should be one of the following: day = Mon / Tue / Wed / Thu / Fri / Sat / Sun And I don't see Di there. This happens because class Mail in web2py does this: payload['Date'] = time.strftime(%a, %d %b %Y %H:%M:%S +, time.gmtime()) The problem is that a lot of those formatters use the current python locale to choose what goes there, which is not a problem if your server is using English which it isn't. You can change the locale using the locale module, but changing locale is not thread safe and I'm not sure what can of worms that would open. The other problem is that strftime is so useless it can't even receive what locale you want to use. This is all easily fixable if you change that line in tools.py to: payload['Date'] = email.utils.formatdate() -- 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: Problem with Date when sending e-mails
Hi, Leonel! Thank you for your reply. The solution is identical to the one I already found by myself in https://groups.google.com/forum/#!topic/web2py/JOX2YIPE8D8 But since this posting dates 2011, I wonder, why that simple and effective solution is not part of the current web2py release. Greetings, Jochen -- 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
Yes, but what code is running that produces the error? Can we see the relevant controlled and/or view code? Also, did you edit the traceback? I don't see any of the calls shown in it. 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: Problem with Date when sending e-mails
Eheh I agree, and since it's an open source project I added a pull request which took quite a while due to my poor git skills and having to revert a borked previous change in my fork. https://github.com/web2py/web2py/pull/383 -- 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?
Let me know if you think we should upgrade. On Monday, 24 February 2014 14:32:05 UTC-6, Mariano Reingart wrote: 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 spamf...@gmail.comjavascript: 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+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] Bug on version 2.8.2
Well, this isn't a question, but a bug report (I'm new to the list). I was following online book, chapter 3, with a small difference. Instead of using singular on tables names I use plural, so I give to the image table the name 'images'. However I made a mistake when referencing images in posts, i.e., I used Field('image_id', 'reference image'), instead of Field('image_id', 'reference images'). Of course, when I tried to post a comment an error message came up. After spending several minutes to figure where the error was (well in this case the ticket system was not so helpful because always pointed to the controller and not the model, where the mistake was), I fix it, but the error message continue. I went to the sql.log file, and table name still was in singular, so I change that in sql.log. No changes, the error continue, albeit the multiple success word in the end of sql.log. The solution I found was delete the storage.sqlite. After that everything went smooth. I'm almost sure that this is a bug in DAL module. HTH, Paulo -- 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
What is file? It must not be the original request.vars.photo you were dealing with, as that was a string object. In any case, looks like file is what we need, so you should now be able to use it in your original code and have web2py automatically rename and save the file via the built-in upload mechanism. Note, looks like file is the expected cgi.FieldStorage object, so file.file would be the actual file object, and file.filename would be the original filename. You don't have to worry about that, though -- you can just pass file in the insert method, and web2py will extract the file and filename automatically. Anthony On Tuesday, February 25, 2014 12:46:52 AM UTC-5, software.ted wrote: 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 softwa...@gmail.comjavascript: wrote: Ok let me check will revert at least you have given me a head start! On 24 Feb 2014 16:27, Anthony abas...@gmail.com javascript: 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
Re: [web2py] Using Recaptcha
Whoa! That works. So the gluon.tools documentation was erroneous. Their prototype did not include 'request', at least, not in the preamble at the top. Thanks. On Monday, 24 February 2014 23:14:32 UTC-5, Kiran Subbaraman wrote: Include request in the parameters, and see if that works. Recaptcha(request, ) Kiran Subbaramanhttp://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, 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+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: CSS table width not limited as wished
Hello, Any idea to help me. I am not a professional, did you notice ? ;) Thank you in advance Dom -- 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: CSS table width not limited as wished
Hello Dominique, sorry fo the lack of response. Would you be able more of your code? It is not clear where the scrollbars come from so I would not know how to remove them. On Tuesday, 25 February 2014 09:23:53 UTC-6, Dominique wrote: Hello, Any idea to help me. I am not a professional, did you notice ? ;) Thank you in advance Dom -- 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] Tuning app performance for good response times on slow servers
Hi, I'm using web2py with nginx and sqlite. And my response times are pretty bad. last time I measured it I god results around 2000ms. When I use google pagespeed it tells me three things I should improve: use browser caching for images, put javascript and css below the fold and check the content management system for known bottlenecks ... The first two I got no clue how to do them or what it means putting something below the fold. Are there any known bottlenecks and fixes for them? 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: Tuning app performance for good response times on slow servers
perhaps you can follow the books advise too on : http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-tricks and the groups advise too on : https://groups.google.com/forum/#!msg/web2py/JgkMaQ_VlXs/m7R7L_ZYQk8J best regards, stifan -- 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: Strange 'SQLTABLE linkto' behaviour
Ticket opened: http://code.google.com/p/web2py/issues/detail?id=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] Re: SQLCustomType bug with grids?
Fixed in trunk: http://code.google.com/p/web2py/issues/detail?id=1871 -- 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: Strange 'SQLTABLE linkto' behaviour
Why are you passing an empty string as action? l = URL('', vars=dict(data='data in vars')) Perhaps you want: l = URL(args=request.args, vars=dict(data='data in vars')) On Thursday, 20 February 2014 04:17:47 UTC-6, mcamel wrote: Hi, I've seen an unexpected 'SQLTABLE linkto' behaviour (both at 2.8.2 and trunk version): In a controller: def sqltablelinkto(): db = DAL('sqlite:memory:') db.define_table('parent',Field('name')) db.parent.insert(name='Parent1') db.parent.insert(name='Parent2') l = URL('') return CAT(H5('request.args=%s' % request.args), H5('request.vars=%s' % request.vars), SQLTABLE(db(db.parent).select(), linkto=l)) This works as expected when you click at the id links: name of table and id of record are passed to args, and nothing to vars. URLs are formed like this: http://.../sqltablelinkto/parent/1 But if you want to pass something in vars, things get weird. Change the url line to: l = URL('', vars=dict(data='data in vars')) Now, when you click at the id links, you get NOTHING at request.args, and all the info is mixed up at request.vars: 'data': 'data in vars/parent/1' The formed url shows the reason: http://.../sqltablelinkto?data=data+in+vars/parent/1 I expected this url to be formed: http://.../sqltablelinkto/parent/1?data=data+in+vars so you'll get args and vars stored properly. Am i doing something wrong or should i open a bug ticket?. 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: CSS table width not limited as wished
I think the problem may be the size of the INPUT. Try add this in style input { width: 50px; } On Tuesday, 25 February 2014 10:49:07 UTC-6, Dominique wrote: Hello Massino, Thank you so much for spending some of your time for me. I appreciate. The following codes will show you my problem: In the controller: def form_test(): form = FORM(TABLE(TR(FIELDSET('This is a test for Field 1: ', INPUT(_name='f1', id='f1')), FIELDSET('This is a test for Field 2: ', INPUT(_name='f2', id='f2')), FIELDSET('This is a test for Field 3: ', INPUT(_name='f3', id='f3')), FIELDSET('This is a test for Field 4: ', INPUT(_name='f4', id='f4')), FIELDSET('This is a test for Field 3: ', INPUT(_name='f5', id='f5')) ), _id='t1')) return dict(form=form) In the view: {{extend 'layout.html'}} style type=text/css table { font-size: 12px; max-width:80%} td{font-weight:bold;vertical-align:top;} fieldset {width:25%; border: groove} /style {{=form}} What I get and what I want are shown in the attached images: I want all the fields to appear on screen without scrollbars. Note that the image what I want is just the code (form + css script) copied in notepad and opened in firefox. The table css properties I add in my script seem not to be taken into account in web2py. The point is that I don't know which web2py file I need to modify (and where). I hope it's clearer ;) Thank you for your help Dominique -- 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: CSS table width not limited as wished
Unfortunately, no ... Le mardi 25 février 2014 18:29:38 UTC+1, Massimo Di Pierro a écrit : I think the problem may be the size of the INPUT. Try add this in style input { width: 50px; } On Tuesday, 25 February 2014 10:49:07 UTC-6, Dominique wrote: Hello Massino, Thank you so much for spending some of your time for me. I appreciate. The following codes will show you my problem: In the controller: def form_test(): form = FORM(TABLE(TR(FIELDSET('This is a test for Field 1: ', INPUT(_name='f1', id='f1')), FIELDSET('This is a test for Field 2: ', INPUT(_name='f2', id='f2')), FIELDSET('This is a test for Field 3: ', INPUT(_name='f3', id='f3')), FIELDSET('This is a test for Field 4: ', INPUT(_name='f4', id='f4')), FIELDSET('This is a test for Field 3: ', INPUT(_name='f5', id='f5')) ), _id='t1')) return dict(form=form) In the view: {{extend 'layout.html'}} style type=text/css table { font-size: 12px; max-width:80%} td{font-weight:bold;vertical-align:top;} fieldset {width:25%; border: groove} /style {{=form}} What I get and what I want are shown in the attached images: I want all the fields to appear on screen without scrollbars. Note that the image what I want is just the code (form + css script) copied in notepad and opened in firefox. The table css properties I add in my script seem not to be taken into account in web2py. The point is that I don't know which web2py file I need to modify (and where). I hope it's clearer ;) Thank you for your help Dominique -- 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: CSS table width not limited as wished
Please try with: table#t1 input{width:auto;} Il giorno martedì 25 febbraio 2014 18:45:31 UTC+1, Dominique ha scritto: Unfortunately, no ... Le mardi 25 février 2014 18:29:38 UTC+1, Massimo Di Pierro a écrit : I think the problem may be the size of the INPUT. Try add this in style input { width: 50px; } On Tuesday, 25 February 2014 10:49:07 UTC-6, Dominique wrote: Hello Massino, Thank you so much for spending some of your time for me. I appreciate. The following codes will show you my problem: In the controller: def form_test(): form = FORM(TABLE(TR(FIELDSET('This is a test for Field 1: ', INPUT(_name='f1', id='f1')), FIELDSET('This is a test for Field 2: ', INPUT(_name='f2', id='f2')), FIELDSET('This is a test for Field 3: ', INPUT(_name='f3', id='f3')), FIELDSET('This is a test for Field 4: ', INPUT(_name='f4', id='f4')), FIELDSET('This is a test for Field 3: ', INPUT(_name='f5', id='f5')) ), _id='t1')) return dict(form=form) In the view: {{extend 'layout.html'}} style type=text/css table { font-size: 12px; max-width:80%} td{font-weight:bold;vertical-align:top;} fieldset {width:25%; border: groove} /style {{=form}} What I get and what I want are shown in the attached images: I want all the fields to appear on screen without scrollbars. Note that the image what I want is just the code (form + css script) copied in notepad and opened in firefox. The table css properties I add in my script seem not to be taken into account in web2py. The point is that I don't know which web2py file I need to modify (and where). I hope it's clearer ;) Thank you for your help Dominique -- 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: Tuning app performance for good response times on slow servers
Every efficiency trick brings down considerably the response time, but usually you'd start from 400 ms response times to go lower, maybe arriving at 100 ms 2 full seconds is so much that it's not web2py the one you should look at it's your app's code. -- 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: Tuning app performance for good response times on slow servers
thecode can't be that bad. Can it? On Tue, Feb 25, 2014 at 8:50 PM, Niphlod niph...@gmail.com wrote: Every efficiency trick brings down considerably the response time, but usually you'd start from 400 ms response times to go lower, maybe arriving at 100 ms 2 full seconds is so much that it's not web2py the one you should look at it's your app's code. -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/fxcPflpF63o/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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] Hiding grid buttons with editable=True
Hello all. With editable=True I don't want to let the possibility to the user to click on buttons at the bottom of the grid: Design Request Response Session DB Tables DB stats I've tried with showbutton=False but it seems that it' don't exist in sqlform.grid. grid = SQLFORM.grid(query=query, csv=False, showbutton=False, searchable=False, editable=True, deletable=False, create=False, details=True) I've see this: https://github.com/mdipierro/web2py-book/pull/155#ref-commit-78fdead Is it an issue ? Is there a solution ? 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: Strange 'SQLTABLE linkto' behaviour
Just to point to the same function in order to make an autocontained example. I don't use empty string in my application. Anyway i've tested your suggestion and gives the same result. El martes, 25 de febrero de 2014 18:26:49 UTC+1, Massimo Di Pierro escribió: Why are you passing an empty string as action? l = URL('', vars=dict(data='data in vars')) Perhaps you want: l = URL(args=request.args, vars=dict(data='data in vars')) -- 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?
I've tried the latest pg8000 as a drop-in replacement, but it seems web2py can't import it: type 'exceptions.RuntimeError' Failure to connect, tried 5 times: Traceback (most recent call last): File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 7766, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 2756, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 795, in find_driver RuntimeError: no driver available ('psycopg2', 'pg8000') I didn't step through it in the debugger, but the module's __init__.pyc got compiled, so I know web2py attempted an import. The latest pg8000/__init__.py contains a section which matches the former interface # For compatibility with 1.8 import pg8000 as dbapi DBAPI = dbapi pg8000_dbapi = DBAPI so I'd guess it's a minor problem, nonetheless I'm lost at this point. On Monday, February 24, 2014 9:32:05 PM UTC+1, Mariano Reingart wrote: 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 spamf...@gmail.comjavascript: 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+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: Hiding grid buttons with editable=True
The buttons to which you refer are not part of the grid at all. Rather, they are generated by response.toolbar(), which perhaps you have in your layout.html file. You can set it to display only when request.is_local is True, so regular users won't see it. Anthony On Tuesday, February 25, 2014 3:31:05 PM UTC-5, Gael Princivalle wrote: Hello all. With editable=True I don't want to let the possibility to the user to click on buttons at the bottom of the grid: Design Request Response Session DB Tables DB stats I've tried with showbutton=False but it seems that it' don't exist in sqlform.grid. grid = SQLFORM.grid(query=query, csv=False, showbutton=False, searchable=False, editable=True, deletable=False, create=False, details=True) I've see this: https://github.com/mdipierro/web2py-book/pull/155#ref-commit-78fdead Is it an issue ? Is there a solution ? 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] Submit FORM not working in IE11
My web2py app is ready, and I was about to deploy, but just found out it doesn't work at al under Internet Explorer 11! I developed everything using safari, chrome also tested in firefox. All working fine. But I have a form (generated via SQLFORM.factory) with a submit button. Using IE11: when pushing the SUBMIT button, is says working very briefly, but then nothing at all happens. I cannot test if older IE versions have the same problem. Are there any special tricks to be applied for IE? Thank you for your help DJ -- 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: Hiding grid buttons with editable=True
...no I don't have response.toolbar() in my layout.html. It's only in generic.html. I've cancel it, and it don't appear any more. Il giorno martedì 25 febbraio 2014 21:50:39 UTC+1, Anthony ha scritto: The buttons to which you refer are not part of the grid at all. Rather, they are generated by response.toolbar(), which perhaps you have in your layout.html file. You can set it to display only when request.is_local is True, so regular users won't see it. Anthony On Tuesday, February 25, 2014 3:31:05 PM UTC-5, Gael Princivalle wrote: Hello all. With editable=True I don't want to let the possibility to the user to click on buttons at the bottom of the grid: Design Request Response Session DB Tables DB stats I've tried with showbutton=False but it seems that it' don't exist in sqlform.grid. grid = SQLFORM.grid(query=query, csv=False, showbutton=False, searchable=False, editable=True, deletable=False, create=False, details=True) I've see this: https://github.com/mdipierro/web2py-book/pull/155#ref-commit-78fdead Is it an issue ? Is there a solution ? 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: Formatting JSON objects with XML() -TypeError: gluon.html.XML object xxxx is not JSON serializable
Anthony, I got this figured out. I had a syntax error on my side. Thanks as always. On Tuesday, February 25, 2014 4:25:14 AM UTC-8, Anthony wrote: Yes, but what code is running that produces the error? Can we see the relevant controller and/or view code? Also, did you edit the traceback? I don't see any of the calls shown in it. 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] Ckeditor plugin - Update ckeditor
Hello all. I've tried to update the ckeditor version of the plugin without success. Someone knows the right way to do it ? Thanks in advance. -- 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: Tuning app performance for good response times on slow servers
try yourself. Take the welcome app from 2.8.2. If /welcome/default/index takes more than 50ms to be served, then it's the server/web2py config. My laptop of 4 years ago with Ubuntu 12.10 loads the page in 22ms with the rocket webserver. First round of fetching static assets with an empty cache takes it to 360ms. -- 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: Submit FORM not working in IE11
Seems other users with Safari have a similar problem with my form, so possibly this is not browser related. Maybe some cookie / authentication issue is in play here? Op dinsdag 25 februari 2014 21:55:42 UTC+1 schreef Davy Jacops: My web2py app is ready, and I was about to deploy, but just found out it doesn't work at al under Internet Explorer 11! I developed everything using safari, chrome also tested in firefox. All working fine. But I have a form (generated via SQLFORM.factory) with a submit button. Using IE11: when pushing the SUBMIT button, is says working very briefly, but then nothing at all happens. I cannot test if older IE versions have the same problem. Are there any special tricks to be applied for IE? Thank you for your help DJ -- 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: Strange 'SQLTABLE linkto' behaviour
Now I understand better. You cannot pass vars to linkto. That is by design because in principle, the linkto function may need parameters specified by the SQLFORM. On Thursday, 20 February 2014 04:17:47 UTC-6, mcamel wrote: Hi, I've seen an unexpected 'SQLTABLE linkto' behaviour (both at 2.8.2 and trunk version): In a controller: def sqltablelinkto(): db = DAL('sqlite:memory:') db.define_table('parent',Field('name')) db.parent.insert(name='Parent1') db.parent.insert(name='Parent2') l = URL('') return CAT(H5('request.args=%s' % request.args), H5('request.vars=%s' % request.vars), SQLTABLE(db(db.parent).select(), linkto=l)) This works as expected when you click at the id links: name of table and id of record are passed to args, and nothing to vars. URLs are formed like this: http://.../sqltablelinkto/parent/1 But if you want to pass something in vars, things get weird. Change the url line to: l = URL('', vars=dict(data='data in vars')) Now, when you click at the id links, you get NOTHING at request.args, and all the info is mixed up at request.vars: 'data': 'data in vars/parent/1' The formed url shows the reason: http://.../sqltablelinkto?data=data+in+vars/parent/1 I expected this url to be formed: http://.../sqltablelinkto/parent/1?data=data+in+vars so you'll get args and vars stored properly. Am i doing something wrong or should i open a bug ticket?. 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: Submit FORM not working in IE11
Can you show some code? Do you have the version of web2py.js associated with the version of web2py you are using? Anthony On Tuesday, February 25, 2014 4:56:11 PM UTC-5, Davy Jacops wrote: Seems other users with Safari have a similar problem with my form, so possibly this is not browser related. Maybe some cookie / authentication issue is in play here? Op dinsdag 25 februari 2014 21:55:42 UTC+1 schreef Davy Jacops: My web2py app is ready, and I was about to deploy, but just found out it doesn't work at al under Internet Explorer 11! I developed everything using safari, chrome also tested in firefox. All working fine. But I have a form (generated via SQLFORM.factory) with a submit button. Using IE11: when pushing the SUBMIT button, is says working very briefly, but then nothing at all happens. I cannot test if older IE versions have the same problem. Are there any special tricks to be applied for IE? Thank you for your help DJ -- 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?
Thanks this does work. Most of my site visitors will be English language speakers, is there any important performance hit I should be aware of? Why is en-us a special case? On Tuesday, February 25, 2014 12:46:41 AM UTC-5, Massimo Di Pierro wrote: 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: Date display i18n internationalization?
One minor downside to T.force(T.http_accept_language) is that when using the web2py shell with models it gives an error: Traceback (most recent call last): File C:\www\web2py\gluon\restricted.py, line 217, in restricted exec ccode in environment File applications\my_app\models\0.py, line 6, in module T.force(T.http_accept_language) File C:\www\web2py\gluon\languages.py, line 661, in force self.accepted_language = language or self.current_languages[0] IndexError: list index out of range On Tuesday, February 25, 2014 9:09:55 PM UTC-5, User wrote: Thanks this does work. Most of my site visitors will be English language speakers, is there any important performance hit I should be aware of? Why is en-us a special case? On Tuesday, February 25, 2014 12:46:41 AM UTC-5, Massimo Di Pierro wrote: 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.
Re: [web2py] pg8000 driver that comes with web2py 2.8.2 is not supporting JSON field type?
Hi Horst: Sadly there have been a lot of changes in pg8000, so it is not backward compatible with the current custom version in web2py. First, you need to delete the pg8000 folder in contrib, and put the new pg8000 folder (the one with __init__.py) directly in the web2py top level folder (at the same level as gluon). Note that the new pg8000 uses absolute imports that will not work if pg8000 is in contrib folder (or it should be added to the PYTHONPATH) Second, you need to apply the attached patch to gluon/dal.py to: * change the import (and add a missing __version__ attribute) * change connection to pass individual parameters (dsn string is not supported anymore) * change after_connection set_client_encoding to execute SQL * change server_version to _server_version I'll propose (again) to the pg8000 group the changes I've introduced for web2py, so the latest version could be used as a direct drop-in replacement for psycopg2 IIRC, at some stage the author gave me commit access, but I didn't have time to pull my changes and missed some discussions about the project internals. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Tue, Feb 25, 2014 at 5:46 PM, Horst Horst spamfra...@gmail.com wrote: I've tried the latest pg8000 as a drop-in replacement, but it seems web2py can't import it: type 'exceptions.RuntimeError' Failure to connect, tried 5 times: Traceback (most recent call last): File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 7766, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 2756, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 795, in find_driver RuntimeError: no driver available ('psycopg2', 'pg8000') I didn't step through it in the debugger, but the module's __init__.pyc got compiled, so I know web2py attempted an import. The latest pg8000/__init__.py contains a section which matches the former interface # For compatibility with 1.8 import pg8000 as dbapi DBAPI = dbapi pg8000_dbapi = DBAPI so I'd guess it's a minor problem, nonetheless I'm lost at this point. On Monday, February 24, 2014 9:32:05 PM UTC+1, Mariano Reingart wrote: 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 spamf...@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+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. diff -r d08638fa7fb1 gluon/dal.py --- a/gluon/dal.py Mon Feb 24 23:57:34 2014 -0600 +++ b/gluon/dal.py Tue Feb 25 23:37:39 2014 -0300 @@ -337,11 +337,14 @@ try: import gluon.contrib.pg8000.dbapi as pg8000 except
[web2py] Re: Date display i18n internationalization?
This is a bug. Please open a ticket. English is not a special case, it simply is the default language. Which means that it assumes it does not need to check translation files for english. On Tuesday, 25 February 2014 20:33:34 UTC-6, User wrote: One minor downside to T.force(T.http_accept_language) is that when using the web2py shell with models it gives an error: Traceback (most recent call last): File C:\www\web2py\gluon\restricted.py, line 217, in restricted exec ccode in environment File applications\my_app\models\0.py, line 6, in module T.force(T.http_accept_language) File C:\www\web2py\gluon\languages.py, line 661, in force self.accepted_language = language or self.current_languages[0] IndexError: list index out of range On Tuesday, February 25, 2014 9:09:55 PM UTC-5, User wrote: Thanks this does work. Most of my site visitors will be English language speakers, is there any important performance hit I should be aware of? Why is en-us a special case? On Tuesday, February 25, 2014 12:46:41 AM UTC-5, Massimo Di Pierro wrote: 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] webcam application
hello everybody, i need help I want to know how I can create a module to create, edit, update videos thank you -- 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] Smartgrid: Display name as string instead of id?
An Item has a supplier as shown in the schema below. I would like smartgrid to diplay a supplier as 'Costco' rather than its id, which is 3. What's wrong with this picture? db_foo.py: db=DAL('sqlite://storage.sqlite') db.define_table('supplier', Field('name', unique=True, requires=IS_NOT_EMPTY())) db.define_table('item', Field('name',unique=True, requires=IS_NOT_EMPTY()), Field('supplied_by','reference supplier')) db.item.supplied_by.requires = IS_IN_DB(db,'supplier.id','%(name)s',zero=T('Choose one')) controller default.py @auth.requires_login() def items(): grid=SQLFORM.smartgrid(db.item) return locals() -- 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: Smartgrid: Display name as string instead of id?
i think it related with record representation db.define_table('supplier', Field('name', unique=True, requires=IS_NOT_EMPTY() ), format = '%(name)s') db.item.supplied_by.requires = IS_IN_DB(db, db.supplier.id, '%(name)s') ref: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation http://web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators best regards, stifan -- 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? I had the same problem, Anthony helped me solve it: See the end of this section in the book: http://web2py.com/books/default/chapter/29/05#HTML-helpers And specifically for data-* attributes, you can now do: form.element('input[id=what3]').update( data={'content':'My text', 'toggle':'popover', 'original-title':'My title'}, _title='') HTML helpers can now take a data argument, which is a dict -- the keys of the dict will be transformed into HTML attributes of the form data-[key]. Note, if the helper already has a data argument and you want to add more data-* attributes, you would update the data dict itself, as follows: form.element('input[id=what3]')['data'].update(newattribute='newvalue') I hope Anthony's reply helps you solve the problem. Kind regards, 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.