[web2py] Deploying Web2py App on Bluehost
I have Python, Web2py and various database technologies installed on an Linux server (say 123.45.67.89). Assuming I've configured my application, databases, and folder permissions properly, is deploying my Web2py application as simple as launching Web2py (the command on my machine would be python web2py.py in /dir1$), setting the server IP to 'public 0.0.0.0', and visiting 123.45.67.89? How does what I'm describing differ from what the following does (from Linux / Unix section of http://www.web2py.com/books/default/chapter/34/13/deployment-recipes): wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh chmod +x setup-web2py-ubuntu.sh sudo ./setup-web2py-ubuntu.sh I don't have a lot of experience deploying applications or working with Apache, so I don't really understand the differences between what I'm doing and the deployment recipe, nor do I really understand what's being described in the *Apache or mod_wsgi setup* sections. Furthermore, when I attempt to run the code above I just receive a bunch of errors (no sudoers, files / directories don't exist, etc). Thanks so much for the help. Just want to make sure I know what's going on, the limitations / differences, etc., especially given the fact that rapid deployment isn't working for me. If you have any decent references that you could point me to, I'd be glad to read them as well. Not sure if it helps, but I'm attempting to deploy on Bluehost with a dedicated IP. Deploying a Django app was a piece of cake on Bluehost, so I hope I'm close. -- 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/d/optout.
[web2py] Deploying Web2py on Bluehost
I posted this on Stackoverflow; thought someone here might be able to help. I have Python, Web2py and various database technologies installed on an Linux server (say 123.45.67.89). Assuming I've configured my application, databases, and folder permissions properly, is deploying my Web2py application as simple as launching Web2py (the command on my machine would be python web2py.py in /dir1$), setting the server IP to 'public 0.0.0.0', and visiting 123.45.67.89? How does what I'm describing differ from what the following does (from Linux / Unix section of http://www.web2py.com/books/default/chapter/34/13/deployment-recipes): wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh chmod +x setup-web2py-ubuntu.sh sudo ./setup-web2py-ubuntu.sh I don't have a lot of experience deploying applications or working with Apache, so I don't really understand the differences between what I'm doing and the deployment recipe, nor do I really understand what's being described in the *Apache or mod_wsgi setup* sections. Thanks so much for the help. Just want to make sure I know what's going on, the limitations / differences, etc. If you have any decent references that you could point me to, I'd be glad to read them as well. *Edit* - Not sure if it helps, but I'm attempting to deploy on Bluehost with a dedicated IP. Deploying a Django app was a piece of cake, so I hope I'm close. -- 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/d/optout.
[web2py] Re: Why does appadmin have css overflow: hidden in database results?
Yes but with overflow:visible (the default css setting) there are no scroll bars and if the table has enough columns than the browser will show a horizontal scrollbar anyway as part of the browser window (as opposed to with auto showing the scrollbars as part of the div). With auto It just gives the feeling of html frames which I thought most people agree are annoying except in limited circumstances. For me it just seems like overflow: auto is just an annoyance with no benefit, but I was wondering if there was something I was overlooking. On Sunday, April 13, 2014 1:46:32 PM UTC-4, Paolo Caruccio wrote: With overflow:auto the scrollbars (vertical and horizontal) are visible only when it is necessary. Making scrollbars visible only when you need them is for aesthetic reasons. Indeed not all the tables have a great number of columns. Il giorno domenica 13 aprile 2014 13:32:41 UTC+2, User ha scritto: Sorry you're right it's auto not hidden that was a typo. But why not make it visible? On Sunday, April 13, 2014 5:37:53 AM UTC-4, Paolo Caruccio wrote: If you mean the view *appadmin/select/db?query=your query* actually the table with the resulting rows is wrapped in a div with overflow:auto. Therefore if you have more columns than the width of the browser a horizontal scrollbar will be shown and the table will scroll horizontally. The horizontal scrollbar (that is managed by browser not by web2py) is positioned after the last displayed row but you can scroll the table with arrow keys on the keyboard. For the sake of completeness, if the div wrapper had overflow:hidden you couldn't see any scrollbar. Il giorno domenica 13 aprile 2014 03:01:35 UTC+2, User ha scritto: In appadmin, if I query a table that has more columns than the width of my browser there will be a horizontal scrollbar places on the div containing the database rows. I find this annoying because in order to scroll horizontally I have to go to the bottom of the search results first to find the horizontal scrollbar and then scroll. If the containing div had overflow: visible then I could use the browser's horizontal scrollbar which is much more convenient. My question is what purpose does having overflow = hidden serve in this context? -- 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/d/optout.
[web2py] Re: Why does appadmin have css overflow: hidden in database results?
Yes agree I did modify my own appadmin copy but I guess don't see why anyone would want the overflow auto in this context. I understand it's for aesthetic but from my POV it's appadmin so this is not end users using it. My thinking was that if I'm annoyed by it others would be too and we should change the default as one drop in the bucket of making web2py better. On Monday, April 14, 2014 9:16:34 AM UTC-4, Paolo Caruccio wrote: Now I see your POV. You are speaking about browser's scrollbars and not about div content area scrollbars. The overflow:auto setting has been applied to the container div of the result table for aestethic reasons because such div should have a width of 80% but there is a bug in the code. I will send a patch on web2py issue tracker. Anyway, if you are not confortable with overflow:auto and since appadmin is a part of w2p application you can easily customize it by replacing the line 68 in /views/appadmin.html with a simple div. Il giorno lunedì 14 aprile 2014 08:25:00 UTC+2, User ha scritto: Yes but with overflow:visible (the default css setting) there are no scroll bars and if the table has enough columns then the browser will show a horizontal scrollbar anyway as part of the browser window (as opposed to with auto showing the scrollbars as part of the div). With auto It just gives the feeling of html frames which I thought most people agree are annoying except in limited circumstances. For me it just seems like overflow: auto is just an annoyance with no benefit, but I was wondering if there was something I was overlooking. On Sunday, April 13, 2014 1:46:32 PM UTC-4, Paolo Caruccio wrote: With overflow:auto the scrollbars (vertical and horizontal) are visible only when it is necessary. Making scrollbars visible only when you need them is for aesthetic reasons. Indeed not all the tables have a great number of columns. Il giorno domenica 13 aprile 2014 13:32:41 UTC+2, User ha scritto: Sorry you're right it's auto not hidden that was a typo. But why not make it visible? On Sunday, April 13, 2014 5:37:53 AM UTC-4, Paolo Caruccio wrote: If you mean the view *appadmin/select/db?query=your query* actually the table with the resulting rows is wrapped in a div with overflow:auto. Therefore if you have more columns than the width of the browser a horizontal scrollbar will be shown and the table will scroll horizontally. The horizontal scrollbar (that is managed by browser not by web2py) is positioned after the last displayed row but you can scroll the table with arrow keys on the keyboard. For the sake of completeness, if the div wrapper had overflow:hidden you couldn't see any scrollbar. Il giorno domenica 13 aprile 2014 03:01:35 UTC+2, User ha scritto: In appadmin, if I query a table that has more columns than the width of my browser there will be a horizontal scrollbar places on the div containing the database rows. I find this annoying because in order to scroll horizontally I have to go to the bottom of the search results first to find the horizontal scrollbar and then scroll. If the containing div had overflow: visible then I could use the browser's horizontal scrollbar which is much more convenient. My question is what purpose does having overflow = hidden serve in this context? -- 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/d/optout.
[web2py] Re: Why does appadmin have css overflow: hidden in database results?
Sorry you're right it's auto not hidden that was a typo. But why not make it visible? On Sunday, April 13, 2014 5:37:53 AM UTC-4, Paolo Caruccio wrote: If you mean the view *appadmin/select/db?query=your query* actually the table with the resulting rows is wrapped in a div with overflow:auto. Therefore if you have more columns than the width of the browser a horizontal scrollbar will be shown and the table will scroll horizontally. The horizontal scrollbar (that is managed by browser not by web2py) is positioned after the last displayed row but you can scroll the table with arrow keys on the keyboard. For the sake of completeness, if the div wrapper had overflow:hidden you couldn't see any scrollbar. Il giorno domenica 13 aprile 2014 03:01:35 UTC+2, User ha scritto: In appadmin, if I query a table that has more columns than the width of my browser there will be a horizontal scrollbar places on the div containing the database rows. I find this annoying because in order to scroll horizontally I have to go to the bottom of the search results first to find the horizontal scrollbar and then scroll. If the containing div had overflow: visible then I could use the browser's horizontal scrollbar which is much more convenient. My question is what purpose does having overflow = hidden serve in this context? -- 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/d/optout.
[web2py] Why does appadmin have css overflow: hidden in database results?
In appadmin, if I query a table that has more columns than the width of my browser there will be a horizontal scrollbar places on the div containing the database rows. I find this annoying because in order to scroll horizontally I have to go to the bottom of the search results first to find the horizontal scrollbar and then scroll. If the containing div had overflow: visible then I could use the browser's horizontal scrollbar which is much more convenient. My question is what purpose does having overflow = hidden serve in this context? -- 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/d/optout.
[web2py] Re: New Windows Vista Install problem
Did you install web2py source version or web2py_win.zip? What python version are you using? And when you run it, what are you doing specifically? On Wednesday, March 26, 2014 4:51:30 PM UTC-4, ian james wrote: I have installed Win2py on my Vista laptop. (My laptop video hardware is not supported on windows 7) When I run Win2py, the CMD window flashes on my screen and then disappears. I have had this problem with a previous Python install years ago. However, the PY application opens a CMD window and seems to run a Python interpreter, so Python does not seem to be the problem. Any suggestions on what to check? -- 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/d/optout.
[web2py] Re: Understanding translation and accept-language header?
Thank you this is what was missing from my understanding, changing langcode to en-gb, caused en-us.py translation to be picked up and en-gb.py to not be. On Friday, March 14, 2014 8:49:17 PM UTC-4, LightDot wrote: I'm less familiar with the translation parts of web2py that I'd like to be, but is this connected with the definitions of: '!langcode!': 'en-us', '!langname!': 'English (US)', that can be found in languages/default.py? Regards On Friday, March 14, 2014 8:39:21 PM UTC+1, User wrote: I'd really like to understand this. If I set the current language to 'en', why does en-gb get translated but en-us does not get translated? On Sunday, March 9, 2014 10:31:57 PM UTC-4, User wrote: So why do en-us and en-gb behave differently? That is, why is en-gb translated and en-us not translated? On Sunday, March 9, 2014 9:04:23 PM UTC-4, Massimo Di Pierro wrote: Because if T.current_languages: ['en'] it means you say that 'en' does not need to be translated. This is the default behaviour. On Friday, 7 March 2014 17:49:23 UTC-6, User wrote: I made a bare bones app based on the welcome app: In db.py: T.current_languages = ['en'] in en-us.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-us', '!langname!': 'English (American)', 'xyztest': 'Pass! (US English)' } in en-gb.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-gb', '!langname!': 'English (British)', 'xyztest': 'Pass! (UK)' } In a view: h2Language testing:/h2 string: strong{{=T('xyztest')}}/strongbr current_languages: {{=T.current_languages}}br T.http_accept_language: {{=T.http_accept_language}}br T.accepted_language: {{=T.accepted_language}}br The rendered output of this is: string: *xyztest* T.current_languages: ['en'] T.http_accept_language: en-us,en;q=0.5 T.accepted_language: en-us Why does this not get translated? By contrast, if I set my browser accept language to include en-gb the rendered output is: string:* Pass! (UK)* T.current_languages: ['en'] T.http_accept_language: en-gb,en-us;q=0.7,en;q=0.3 T.accepted_language: en-gb -- 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/d/optout.
[web2py] Re: Understanding translation and accept-language header?
I was manually setting T.current_languages = ['en'] in db.py but am I correct that this statement has no impact then? It doesn't seem to do anything. Even setting to T.current_languages = ['es'] has no impact. On Saturday, March 15, 2014 8:38:58 PM UTC-4, Massimo Di Pierro wrote: Yes. This is the relevant code in gluon/languages.py def set_current_languages(self, *languages): Sets current AKA default languages Setting one of this languages makes the force() function to turn translation off self.default_language_file = pjoin(self.langpath, 'default.py') self.default_t = read_dict(self.default_language_file) self.current_languages = [pl_info[0]] # !langcode! ... On Friday, 14 March 2014 19:49:17 UTC-5, LightDot wrote: I'm less familiar with the translation parts of web2py that I'd like to be, but is this connected with the definitions of: '!langcode!': 'en-us', '!langname!': 'English (US)', that can be found in languages/default.py? Regards On Friday, March 14, 2014 8:39:21 PM UTC+1, User wrote: I'd really like to understand this. If I set the current language to 'en', why does en-gb get translated but en-us does not get translated? On Sunday, March 9, 2014 10:31:57 PM UTC-4, User wrote: So why do en-us and en-gb behave differently? That is, why is en-gb translated and en-us not translated? On Sunday, March 9, 2014 9:04:23 PM UTC-4, Massimo Di Pierro wrote: Because if T.current_languages: ['en'] it means you say that 'en' does not need to be translated. This is the default behaviour. On Friday, 7 March 2014 17:49:23 UTC-6, User wrote: I made a bare bones app based on the welcome app: In db.py: T.current_languages = ['en'] in en-us.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-us', '!langname!': 'English (American)', 'xyztest': 'Pass! (US English)' } in en-gb.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-gb', '!langname!': 'English (British)', 'xyztest': 'Pass! (UK)' } In a view: h2Language testing:/h2 string: strong{{=T('xyztest')}}/strongbr current_languages: {{=T.current_languages}}br T.http_accept_language: {{=T.http_accept_language}}br T.accepted_language: {{=T.accepted_language}}br The rendered output of this is: string: *xyztest* T.current_languages: ['en'] T.http_accept_language: en-us,en;q=0.5 T.accepted_language: en-us Why does this not get translated? By contrast, if I set my browser accept language to include en-gb the rendered output is: string:* Pass! (UK)* T.current_languages: ['en'] T.http_accept_language: en-gb,en-us;q=0.7,en;q=0.3 T.accepted_language: en-gb -- 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/d/optout.
[web2py] Re: Understanding translation and accept-language header?
I'd really like to understand this. If I set the current language to 'en', why does en-gb get translated but en-us does not get translated? On Sunday, March 9, 2014 10:31:57 PM UTC-4, User wrote: So why do en-us and en-gb behave differently? That is, why is en-gb translated and en-us not translated? On Sunday, March 9, 2014 9:04:23 PM UTC-4, Massimo Di Pierro wrote: Because if T.current_languages: ['en'] it means you say that 'en' does not need to be translated. This is the default behaviour. On Friday, 7 March 2014 17:49:23 UTC-6, User wrote: I made a bare bones app based on the welcome app: In db.py: T.current_languages = ['en'] in en-us.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-us', '!langname!': 'English (American)', 'xyztest': 'Pass! (US English)' } in en-gb.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-gb', '!langname!': 'English (British)', 'xyztest': 'Pass! (UK)' } In a view: h2Language testing:/h2 string: strong{{=T('xyztest')}}/strongbr current_languages: {{=T.current_languages}}br T.http_accept_language: {{=T.http_accept_language}}br T.accepted_language: {{=T.accepted_language}}br The rendered output of this is: string: *xyztest* T.current_languages: ['en'] T.http_accept_language: en-us,en;q=0.5 T.accepted_language: en-us Why does this not get translated? By contrast, if I set my browser accept language to include en-gb the rendered output is: string:* Pass! (UK)* T.current_languages: ['en'] T.http_accept_language: en-gb,en-us;q=0.7,en;q=0.3 T.accepted_language: en-gb -- 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/d/optout.
[web2py] Re: Understanding translation and accept-language header?
So why do en-us and en-gb behave differently? That is, why is en-gb translated and en-us not translated? On Sunday, March 9, 2014 9:04:23 PM UTC-4, Massimo Di Pierro wrote: Because if T.current_languages: ['en'] it means you say that 'en' does not need to be translated. This is the default behaviour. On Friday, 7 March 2014 17:49:23 UTC-6, User wrote: I made a bare bones app based on the welcome app: In db.py: T.current_languages = ['en'] in en-us.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-us', '!langname!': 'English (American)', 'xyztest': 'Pass! (US English)' } in en-gb.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-gb', '!langname!': 'English (British)', 'xyztest': 'Pass! (UK)' } In a view: h2Language testing:/h2 string: strong{{=T('xyztest')}}/strongbr current_languages: {{=T.current_languages}}br T.http_accept_language: {{=T.http_accept_language}}br T.accepted_language: {{=T.accepted_language}}br The rendered output of this is: string: *xyztest* T.current_languages: ['en'] T.http_accept_language: en-us,en;q=0.5 T.accepted_language: en-us Why does this not get translated? By contrast, if I set my browser accept language to include en-gb the rendered output is: string:* Pass! (UK)* T.current_languages: ['en'] T.http_accept_language: en-gb,en-us;q=0.7,en;q=0.3 T.accepted_language: en-gb -- 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/d/optout.
[web2py] meta.description = None?
Sometimes I want to completely remove the meta description tag (as this is one of the recommended options according to Google: http://www.youtube.com/watch?v=W4gr88oHb-k) For example I have a default meta description tag defined in menu.py (as is in the welcome app). Then in a specific controller function I'd like to remove that meta description tag so I try: response.meta.description = None However instead of completely removing the meta tag from the rendered html this produces: meta name=description content=None / which seems kind of pointless. So three things: 1. What is a workaround to remove the meta description tag from a controller? 2. What changing web2py so when response.meta.description = None, there is no meta tag output? 3. What about completely removing the response.meta.description from the welcome app, since according to Google, duplicate meta description tags are a bad thing and having no tag is better than having a duplicate tag? -- 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/d/optout.
[web2py] Re: meta.description = None?
That works and I have done that but it still doesn't address that setting description to None prints out the string None. That behavior doesn't seem correct to me. Also the welcome app default setting is not google friendly. On Friday, March 7, 2014 2:16:35 PM UTC-5, Anthony wrote: Just remove the response.meta.description line from menu.py. Anthony On Friday, March 7, 2014 1:02:10 PM UTC-5, User wrote: Sometimes I want to completely remove the meta description tag (as this is one of the recommended options according to Google: http://www.youtube.com/watch?v=W4gr88oHb-k) For example I have a default meta description tag defined in menu.py (as is in the welcome app). Then in a specific controller function I'd like to remove that meta description tag so I try: response.meta.description = None However instead of completely removing the meta tag from the rendered html this produces: meta name=description content=None / which seems kind of pointless. So three things: 1. What is a workaround to remove the meta description tag from a controller? 2. What about changing web2py so when response.meta.description = None, there is no meta tag output? 3. What about completely removing the response.meta.description from the welcome app, since according to Google, duplicate meta description tags are a bad thing and having no tag is better than having a duplicate tag? -- 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/d/optout.
[web2py] Re: meta.description = None?
On Friday, March 7, 2014 4:08:56 PM UTC-5, Anthony wrote: On Friday, March 7, 2014 2:58:19 PM UTC-5, User wrote: That works and I have done that but it still doesn't address that setting description to None prints out the string None. Why would you explicitly set it to None rather than (a) not setting it at all or (b) deleting the key using del? By default, response.meta is empty, so if you explicitly add a key to it, the assumption is that you want that key included. That behavior doesn't seem correct to me. Also the welcome app default setting is not google friendly. del was what I was looking for, it didn't dawn on me to use this or whether this would break anything. But I agree I have removed it from menu.py as there is zero benefit to having a fixed meta description throughout the site. -- 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/d/optout.
[web2py] Re: meta.description = None?
Issue created: http://code.google.com/p/web2py/issues/detail?id=1891 On Friday, March 7, 2014 4:34:54 PM UTC-5, User wrote: On Friday, March 7, 2014 4:08:56 PM UTC-5, Anthony wrote: On Friday, March 7, 2014 2:58:19 PM UTC-5, User wrote: That works and I have done that but it still doesn't address that setting description to None prints out the string None. Why would you explicitly set it to None rather than (a) not setting it at all or (b) deleting the key using del? By default, response.meta is empty, so if you explicitly add a key to it, the assumption is that you want that key included. That behavior doesn't seem correct to me. Also the welcome app default setting is not google friendly. del was what I was looking for, it didn't dawn on me to use this or whether this would break anything. But I agree I have removed it from menu.py as there is zero benefit to having a fixed meta description throughout the site. -- 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/d/optout.
[web2py] Understanding translation and accept-language header?
I made a bare bones app based on the welcome app: In db.py: T.current_languages = ['en'] in en-us.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-us', '!langname!': 'English (American)', 'xyztest': 'Pass! (US English)' } in en-gb.py: # -*- coding: utf-8 -*- { '!langcode!': 'en-gb', '!langname!': 'English (British)', 'xyztest': 'Pass! (UK)' } In a view: h2Language testing:/h2 string: strong{{=T('xyztest')}}/strongbr current_languages: {{=T.current_languages}}br T.http_accept_language: {{=T.http_accept_language}}br T.accepted_language: {{=T.accepted_language}}br The rendered output of this is: string: *xyztest* T.current_languages: ['en'] T.http_accept_language: en-us,en;q=0.5 T.accepted_language: en-us Why does this not get translated? By contrast, if I set my browser accept language to include en-gb the rendered output is: string:* Pass! (UK)* T.current_languages: ['en'] T.http_accept_language: en-gb,en-us;q=0.7,en;q=0.3 T.accepted_language: en-gb -- 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/d/optout.
Re: [web2py] Re: How do I track who clicks a submit button?
What does the submit button do? On Friday, March 7, 2014 6:20:46 PM UTC-5, Austin Taylor wrote: Thank you so much, Anthony. What if I have multiple users logged in? How would I store their ID upon clicking? Sorry I'm still learning I know that is a noob question. On Fri, Mar 7, 2014 at 5:54 PM, Anthony abas...@gmail.com javascript: wrote: Depends on your goals. If we're talking about a SQLFORM based on a db table, it might make more sense to have a created_by and/or modified_by field in the table. The field(s) could be set to readable=writable=False, and set the default to auth.user_id. Whenever a record is inserted or updated, you then have the id of the user. In any case, the current logged in user's id is in auth.user_id (which is None if the user isn't logged in), so you could store that wherever you like upon form submission. Anthony On Friday, March 7, 2014 5:01:03 PM UTC-5, Austin Taylor wrote: I'm trying to figure out a way to track users who click the submit button. Maybe using their db.auth_user.username and appending it to a list whenever they click submit? I literally just have no idea where to start and any advice would be appreciated. Best, Austin -- 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/JQayRnZibYA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- 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/d/optout.
[web2py] Re: Can I specify a display name in emails sent via auth.settings.mailer?
Anyone? On Wednesday, February 5, 2014 6:26:01 PM UTC-5, User wrote: I would like the from address of automated emails for user registration, retrieve password, etc to have a display name. How can I do this? Currently my mailer is defined similar to: mail = auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'i...@example.com' Can I do something like this? mail.settings.sender = 'Company Name i...@example.com''companyi...@example.com' I saw this related post: https://groups.google.com/forum/#!topic/web2py/GCY_jQusDKk but that is only discussing the mail.send() method I believe -- 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/d/optout.
[web2py] Re: appadmin redirects to admin on first try?
No I am not being redirected to admin login page first. I have edited admin/models/0.py: EXPIRATION = 48 * 60 * 60 # logout after 48 hours of inactivity A while could be 24 hours. On Tuesday, March 4, 2014 4:28:38 PM UTC-5, Anthony wrote: On Tuesday, March 4, 2014 4:06:58 PM UTC-5, User wrote: I am already logged in, but haven't visited the site in a while. How long is a while? By default, I believe the admin login lasts for only 60 minutes. When you go to appadmin, you say you first get redirected to admin. My question is are you being redirected to the admin login page prior to seeing the admin interface? 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] appadmin redirects to admin on first try?
Whenever I visit my appadmin page url it redirects me to the admin page on the first try. If I go to my appadmin page a second time it will correctly take me to appadmin. For example: I visit: https://www.example.com/my_app/appadmin/index This redirects me to the following on the first try: https://www.example.com/admin/default/site If I again try to go to: https://www.example.com/my_app/appadmin/index it will correctly take me to the appadmin page. 1. Why is this happening? 2. How do I fix it so it takes me to the correct page on the first try? -- 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: appadmin redirects to admin on first try?
I am already logged in, but haven't visited the site in a while. On Tuesday, March 4, 2014 3:44:31 PM UTC-5, Anthony wrote: Are you being asked to log in to admin, or are you already logged in at the time? On Tuesday, March 4, 2014 3:37:23 PM UTC-5, User wrote: Whenever I visit my appadmin page url it redirects me to the admin page on the first try. If I go to my appadmin page a second time it will correctly take me to appadmin. For example: I visit: https://www.example.com/my_app/appadmin/index This redirects me to the following on the first try: https://www.example.com/admin/default/site If I again try to go to: https://www.example.com/my_app/appadmin/index it will correctly take me to the appadmin page. 1. Why is this happening? 2. How do I fix it so it takes me to the correct page on the first try? -- 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.
[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?
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] Date display i18n internationalization?
I have some dates that I want to display in the proper culture specific format. I want a simple solution so what I want is rather than me having to specify the date format for every possible culture is to use the following default: dd-mm- and then specify a handful of exceptions, e.g. for United States: mm-dd- How can I achieve this in web2py where it's switched based on the Accept-Language header? -- 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?
Sorry I'm not following the relevance of that forum topic. What I'm trying to do for example is: I have a date in javascript in a view : var dateFormat = {{=T('dd mmm ')}}) Later on this will get expanded to for example 20 January 2014. For the US, I want the date displayed as January 20, 2014. So I created a en-us.py language file with the following content: { '!langcode!': 'en-us', '!langname!': 'English (United States)', 'dd mmm ':'mmm dd, ' } I restarted web2py. However with my browser Accept-Language set to en-us I still see the date as 20 January 2014. My full firefox header is: Accept-Language en-us,en;q=0.5 What am I missing about how T works? On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote: https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote: I have some dates that I want to display in the proper culture specific format. I want a simple solution so what I want is rather than me having to specify the date format for every possible culture is to use the following default: dd-mm- and then specify a handful of exceptions, e.g. for United States: mm-dd- How can I achieve this in web2py where it's switched based on the Accept-Language header? -- 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 in layout.html. Viewing the rendered source in the browser the output is var dateFormat = dd mmm ; Putting T.force('en-us') at the end of models/models.py didn't not change anything. In fact, to take javascript out of the picture I just put a simple T statement in the footer of my layout.html: {{=T('this-is-a-test')}} And added an entry for it in en-us.py { '!langcode!': 'en-us', '!langname!': 'English (United States)', 'dd mmm ':'mmm dd, ', 'this-is-a-test': 'PASS' } The output remains: this-is-a-test I can easily insert an debug breakpoint: import ipdb; ipdb.set_trace() if that will help examine anything. On Monday, February 24, 2014 1:27:10 AM UTC-5, Massimo Di Pierro wrote: This should work. I do not think the problem is in T. Anyway, let's rule that out. Where is this, in a HTML file? When you look at the source file, is the string {{=T('dd mmm ')}}) translated? What if you add the following to your model? T.force('en-us') On Sunday, 23 February 2014 23:08:14 UTC-6, User wrote: Sorry I'm not following the relevance of that forum topic. What I'm trying to do for example is: I have a date in javascript in a view : var dateFormat = {{=T('dd mmm ')}}) Later on this will get expanded to for example 20 January 2014. This works and the date display as expected. For the US, I want the date displayed as January 20, 2014. So I created a en-us.py language file with the following content: { '!langcode!': 'en-us', '!langname!': 'English (United States)', 'dd mmm ':'mmm dd, ' } I restarted web2py. However, with my browser Accept-Language set to en-us I still see the date as 20 January 2014. My full firefox header is: Accept-Language en-us,en;q=0.5 What am I missing about how T works? On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote: https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote: I have some dates that I want to display in the proper culture specific format. I want a simple solution so what I want is rather than me having to specify the date format for every possible culture is to use the following default: dd-mm- and then specify a handful of exceptions, e.g. for United States: mm-dd- How can I achieve this in web2py where it's switched based on the Accept-Language header? -- 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?
Also I tried in web2py shell: str(T('this-is-a-test', language='en-us')) which returns: 'this-is-a-test' Not sure if this makes any sense calling from the shell but figured I try it. On Monday, February 24, 2014 2:02:25 AM UTC-5, User wrote: This in layout.html. Viewing the rendered source in the browser the output is var dateFormat = dd mmm ; Putting T.force('en-us') at the end of models/models.py didn't change anything. In fact, to take javascript out of the picture I just put a simple T statement in the footer of my layout.html: {{=T('this-is-a-test')}} And added an entry for it in en-us.py { '!langcode!': 'en-us', '!langname!': 'English (United States)', 'dd mmm ':'mmm dd, ', 'this-is-a-test': 'PASS' } The output remains: this-is-a-test I can easily insert an debug breakpoint: import ipdb; ipdb.set_trace() if that will help examine anything. On Monday, February 24, 2014 1:27:10 AM UTC-5, Massimo Di Pierro wrote: This should work. I do not think the problem is in T. Anyway, let's rule that out. Where is this, in a HTML file? When you look at the source file, is the string {{=T('dd mmm ')}}) translated? What if you add the following to your model? T.force('en-us') On Sunday, 23 February 2014 23:08:14 UTC-6, User wrote: Sorry I'm not following the relevance of that forum topic. What I'm trying to do for example is: I have a date in javascript in a view : var dateFormat = {{=T('dd mmm ')}}) Later on this will get expanded to for example 20 January 2014. This works and the date display as expected. For the US, I want the date displayed as January 20, 2014. So I created a en-us.py language file with the following content: { '!langcode!': 'en-us', '!langname!': 'English (United States)', 'dd mmm ':'mmm dd, ' } I restarted web2py. However, with my browser Accept-Language set to en-us I still see the date as 20 January 2014. My full firefox header is: Accept-Language en-us,en;q=0.5 What am I missing about how T works? On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote: https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote: I have some dates that I want to display in the proper culture specific format. I want a simple solution so what I want is rather than me having to specify the date format for every possible culture is to use the following default: dd-mm- and then specify a handful of exceptions, e.g. for United States: mm-dd- How can I achieve this in web2py where it's switched based on the Accept-Language header? -- 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?
To clarify further, I made an entry in languages/es.py and when I set my browser preferred language to es I get the entry I put in the es.py file. So translation is working. However, when I set my browser to en-us it does not seem to pick up the entry in en-us.py file On Monday, February 24, 2014 2:13:04 AM UTC-5, User wrote: Also I tried in web2py shell: str(T('this-is-a-test', language='en-us')) which returns: 'this-is-a-test' Not sure if this makes any sense calling from the shell but figured I try it. On Monday, February 24, 2014 2:02:25 AM UTC-5, User wrote: This in layout.html. Viewing the rendered source in the browser the output is var dateFormat = dd mmm ; Putting T.force('en-us') at the end of models/models.py didn't change anything. In fact, to take javascript out of the picture I just put a simple T statement in the footer of my layout.html: {{=T('this-is-a-test')}} And added an entry for it in en-us.py { '!langcode!': 'en-us', '!langname!': 'English (United States)', 'dd mmm ':'mmm dd, ', 'this-is-a-test': 'PASS' } The output remains: this-is-a-test I can easily insert an debug breakpoint: import ipdb; ipdb.set_trace() if that will help examine anything. On Monday, February 24, 2014 1:27:10 AM UTC-5, Massimo Di Pierro wrote: This should work. I do not think the problem is in T. Anyway, let's rule that out. Where is this, in a HTML file? When you look at the source file, is the string {{=T('dd mmm ')}} ) translated? What if you add the following to your model? T.force('en-us') On Sunday, 23 February 2014 23:08:14 UTC-6, User wrote: Sorry I'm not following the relevance of that forum topic. What I'm trying to do for example is: I have a date in javascript in a view : var dateFormat = {{=T('dd mmm ')}}) Later on this will get expanded to for example 20 January 2014. This works and the date display as expected. For the US, I want the date displayed as January 20, 2014. So I created a en-us.py language file with the following content: { '!langcode!': 'en-us', '!langname!': 'English (United States)', 'dd mmm ':'mmm dd, ' } I restarted web2py. However, with my browser Accept-Language set to en-us I still see the date as 20 January 2014. My full firefox header is: Accept-Language en-us,en;q=0.5 What am I missing about how T works? On Sunday, February 23, 2014 8:39:56 PM UTC-5, Massimo Di Pierro wrote: https://groups.google.com/forum/#!msg/web2py/ZxdTaSM1Fpk/hGryHgztlPQJ On Sunday, 23 February 2014 19:06:56 UTC-6, User wrote: I have some dates that I want to display in the proper culture specific format. I want a simple solution so what I want is rather than me having to specify the date format for every possible culture is to use the following default: dd-mm- and then specify a handful of exceptions, e.g. for United States: mm-dd- How can I achieve this in web2py where it's switched based on the Accept-Language header? -- 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?
In fact, it put an entry in en-gb.py and set my browser accept 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 in en-gb or es, web2py seems to automatically modify those 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] Use custom XML TAG to generate void or self-closing tags?
How can I generate a self-closing tag ( http://dev.w3.org/html5/html-author/#start-tag) or void element using the TAG helper? For example, in the header I want to generate: link rel=next href=http://example.com/article?pg=2; or link rel=next href=http://example.com/article?pg=2/ However using TAG.link(_rel='next', _href='http://example.com/article?pg=2') generates: link rel=next href=http://example.com/article?pg=2;/link -- 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: Use custom XML TAG to generate void or self-closing tags?
Out of curiosity is the HTML syntax for void elements possible (i.e. start tag only) with a helper? e.g. link rel=next href=http://example.com/article?pg=2; On Friday, February 21, 2014 5:37:57 PM UTC-5, Anthony wrote: TAG['link/'](_href=...) To generate a self-closing tag, the tag name must end with a /, so to do that, you need to use the TAG[tagname] syntax instead of TAG.tagname. Anthony On Friday, February 21, 2014 4:43:08 PM UTC-5, User wrote: How can I generate a self-closing tag ( http://dev.w3.org/html5/html-author/#start-tag) or void element using the TAG helper? For example, in the header I want to generate: link rel=next href=http://example.com/article?pg=2; or link rel=next href=http://example.com/article?pg=2/ However using TAG.link(_rel='next', _href=' http://example.com/article?pg=2') generates: link rel=next href=http://example.com/article?pg=2;/link -- 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 can I restrict an input field to latin alphabet characters only?
I agree the IS_MATCH could work but what is the regex that you would use? On Thursday, February 20, 2014 9:06:23 AM UTC-5, Leonel Câmara wrote: I'm guessing you can use IS_MATCH. Another alternative, you could make a validator that would try and encode a unicode version of the text you're validating to iso-8859-15 or something and see if you don't get any exceptions. -- 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] How can I restrict an input field to latin alphabet characters only?
How can I restrict an input field to (extended) latin alphabet characters only? I'm thinking a validator that will return an error message if characters are not extended Latin characters Basically I want to allow: Zürich or Cancún but reject: 上海市 or دبي -- 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: Version Control advice
I also agree with separate repositories per app. My web2py folder is a mercurial repository (I cloned the web2py repository http://code.google.com/p/web2py/source/checkout) Then for each application I want to make, I create a new repository for that application in the web2py/applications folder. So you end up with a nested repository structure but they actually play nicely and don't interfere with each other (thanks to the ignore files) This way I can update web2py as needed to get new versions or bug fixes. And my applications are in separate repositories because they really have nothing to do with web2py core. On Wednesday, February 19, 2014 6:00:37 AM UTC-5, Tim Richardson wrote: Well, I'm not very sophisticated but I have separate git repositories per app, I can't any advantages in having one repository for everything. On Wednesday, 19 February 2014 12:13:13 UTC+11, Carlos Zenteno wrote: Do you guys version control just the /applications directory or the whole web2py tree? What is better for auto-deployment when pushing to the production repo? 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.
Re: [web2py] How can I run postgresql VACUUM from web2py?
Good point seems autovacuum is already turned on, so not necessary. Although purely out of curiosity I'd still be interested to hear how to execute this statement if possible or is it not possible from web2py? On Tuesday, February 18, 2014 11:18:17 AM UTC-5, Richard wrote: postgresql.conf autovacuum = on Except you have particular need should be alright with postgres 9 + Richard On Mon, Feb 17, 2014 at 8:42 PM, User sour...@gmail.com javascript:wrote: I'm trying to run postgresql vacuum from web2py (ultimately to be run by a scheduled task) and I get the following error: db.executesql('VACUUM sometable;') *** ProgrammingError: ('ERROR', '25001', 'VACUUM cannot run inside a transaction block') How can I run VACUUM from 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] How can I run postgresql VACUUM from web2py?
I'm trying to run postgresql vacuum from web2py (ultimately to be run by a scheduled task) and I get the following error: db.executesql('VACUUM sometable;') *** ProgrammingError: ('ERROR', '25001', 'VACUUM cannot run inside a transaction block') How can I run VACUUM from 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.
[web2py] ReCaptcha: type 'exceptions.SyntaxError' setting key 'login_catpcha' does not exist?
I want to add a captcha to my login form. Eventually I want this to be conditional based on how many login attemps have been made. However, my first step is to get it to show on the login form. In my default.py controller I have: def user(): function = request.args(0) if function == 'register': # ... elif function == 'login': #import ipdb; ipdb.set_trace() auth.settings.login_onfail = login_failed from gluon.tools import Recaptcha public_key = 'xyz' private_key = 'xyz' auth.settings.login_catpcha = Recaptcha(request, public_key,private_key ) form = auth.login() return dict(form=form) When I visit the page I get: type 'exceptions.SyntaxError' setting key 'login_catpcha' does not exist Commenting out offending line and the code works (albeit without a captcha) Any ideas on what's 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: ReCaptcha: type 'exceptions.SyntaxError' setting key 'login_catpcha' does not exist?
good catch it's working now On Friday, February 14, 2014 11:06:39 PM UTC-5, Massimo Di Pierro wrote: auth.settings.login_catpcha = Recaptcha(request, public_key, private_key) should be auth.settings.login_captcha = Recaptcha(request, public_key, private_key) On Friday, 14 February 2014 11:31:57 UTC-6, User wrote: I want to add a captcha to my login form. Eventually I want this to be conditional based on how many login attemps have been made. However, my first step is to get it to show on the login form. In my default.py controller I have: def user(): function = request.args(0) if function == 'register': # ... elif function == 'login': #import ipdb; ipdb.set_trace() auth.settings.login_onfail = login_failed from gluon.tools import Recaptcha public_key = 'xyz' private_key = 'xyz' auth.settings.login_catpcha = Recaptcha(request, public_key,private_key ) form = auth.login() return dict(form=form) When I visit the page I get: type 'exceptions.SyntaxError' setting key 'login_catpcha' does not exist Commenting out offending line and the code works (albeit without a captcha) Any ideas on what's 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: How can I show response.flash messages with different styles?
I like this, but will it play nicely with built-in flash messages? Seems like if you get a web2py built in flash message (e.g. logged in,logged out) it will come out with no styling since the styling is now in the function rather than the layout? Although there aren't so many built-in messages that you couldn't override them so probably not that big of an issue. On Wednesday, February 12, 2014 10:13:03 PM UTC-5, Anthony wrote: On Wednesday, February 12, 2014 9:48:34 PM UTC-5, Cliff Kachinske wrote: response.flash = SPAN('flash message goes here', _class='whatever') And since this case involves a div and a button, to avoid having to repeat all that every time, just write a function that takes a message and a flash type and generates the appropriate helper object: def flash(message, type='info'): return DIV(BUTTON(XML('times;'), _type='button', _class='close', data =dict(dismiss='alert')), message, class='alert alert-%s' % type) response.flash = flash('You did it!', 'success') Anthony On Wednesday, February 12, 2014 8:54:46 PM UTC-5, User wrote: I am using bootstrap 2.3.2 and I would like to use Bootstrap css alert classes to style response.flash. These include: alert alert-error alert-success alert-info Is there an easy way to specify the type of flash from the controller? I'm thinking I could do something like: response.flash_style = 'alert-success' and then: {{if response.flash:}} div class=alert{{=response.flash_style or ' alert-info'}} button type=button class=close data-dismiss=alerttimes ;/button {{=response.flash}} /div {{pass}} -- 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] Recording failed login attempts in database via login_onfail?
I want to record the number of failed login attempts in db.auth_user. I've added an extra field: auth.settings.extra_fields['auth_user'] = [ Field('failed_login_attempts','integer', default=0), My thought was to capture increment this number in login_onfail. However, how can I find out which user failed the login from this function handler? As far as I can see it doesn't take the login form as an argument like onaccept. Or if that is not possible where in the chain of events can I increment this count on a failed login? -- 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 can I show response.flash messages with different styles?
It works, just looking for best practices. Curious if anyone had anything really slick. Not too crazy about adding on the fly attribute to response object, but perhaps a slightly more mangled name would make me more comfortable with that (Although chance of collision seems pretty small and if it were to happen would be easy enough to change) On Wednesday, February 12, 2014 9:36:58 PM UTC-5, Anthony wrote: Does your solution below not work? On Wednesday, February 12, 2014 8:54:46 PM UTC-5, User wrote: I am using bootstrap 2.3.2 and I would like to use Bootstrap css alert classes to style response.flash. These include: alert alert-error alert-success alert-info Is there an easy way to specify the type of flash from the controller? I'm thinking I could do something like: response.flash_style = 'alert-success' and then: {{if response.flash:}} div class=alert{{=response.flash_style or ' alert-info'}} button type=button class=close data-dismiss=alerttimes;/ button {{=response.flash}} /div {{pass}} -- 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: possible bug with IS_TIME() midnight in 12 hour format?
Thanks, also seems like there should be the following test cases in \web2py\gluon\tests\test_validators.py def test_IS_TIME(self): rtn = IS_TIME()('12:00 am') self.assertEqual(rtn, (datetime.time(0, 0), None)) rtn = IS_TIME()('12:01 am') self.assertEqual(rtn, (datetime.time(0, 1), None)) rtn = IS_TIME()('12:00 pm') self.assertEqual(rtn, (datetime.time(12, 0), None)) On Tuesday, February 11, 2014 9:10:51 AM UTC-5, Massimo Di Pierro wrote: You are right. Now fixed in trunk. On Tuesday, 11 February 2014 01:57:25 UTC-6, User wrote: I have an input field on a form where users can enter a time in 12-hour format. Entering 12:00AM on this form seems to be getting interpreted as 12PM (debugging I can see the python time object is datetime.time(12, 0). Calling the validator directly in the web2py shell gives: rtn = IS_TIME()('12:00 am') (datetime.time(12, 0), None) Is this a bug? Shouldn't it return datetime.time(0, 0)? Also, seems a little odd that there are no test cases for midnight or noon in def test_IS_TIME(self) -- 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: web2py scheduler
You could try adding standard python logging statements to try to figure out what's happening. Edit web2py-root/logging.conf and add an entry for your app following the instructions in the file. Then in scheduler.py: import logging def your_scheduled_function(): logger = logging.getLogger('web2py.app.your_app') logger.debug('BEGIN: your_scheduled_function') ... Then check web2py-root/logs folder for the log output On Tuesday, February 11, 2014 5:06:21 AM UTC-5, Jayadevan M wrote: How can I debug a scheduler task that goes into RUNNING status and never changes to any other status? The same function, when called from web2py in shell mode, does what it is expected to do and exits normally. -- 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: possible bug with IS_TIME() midnight in 12 hour format?
Possibly, I have never contributed to an open source project so I don't know what's involved. Are there instructions somewhere? On Tuesday, February 11, 2014 11:21:15 AM UTC-5, Massimo Di Pierro wrote: I agree. Can you submit a patch? On Tuesday, 11 February 2014 09:33:40 UTC-6, User wrote: Thanks, also seems like there should be the following test cases in \web2py\gluon\tests\test_validators.py def test_IS_TIME(self): rtn = IS_TIME()('12:00 am') self.assertEqual(rtn, (datetime.time(0, 0), None)) rtn = IS_TIME()('12:01 am') self.assertEqual(rtn, (datetime.time(0, 1), None)) rtn = IS_TIME()('12:00 pm') self.assertEqual(rtn, (datetime.time(12, 0), None)) On Tuesday, February 11, 2014 9:10:51 AM UTC-5, Massimo Di Pierro wrote: You are right. Now fixed in trunk. On Tuesday, 11 February 2014 01:57:25 UTC-6, User wrote: I have an input field on a form where users can enter a time in 12-hour format. Entering 12:00AM on this form seems to be getting interpreted as 12PM (debugging I can see the python time object is datetime.time(12, 0). Calling the validator directly in the web2py shell gives: rtn = IS_TIME()('12:00 am') (datetime.time(12, 0), None) Is this a bug? Shouldn't it return datetime.time(0, 0)? Also, seems a little odd that there are no test cases for midnight or noon in def test_IS_TIME(self) -- 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: possible bug with IS_TIME() midnight in 12 hour format?
Can this be done with Mercurial? On Tuesday, February 11, 2014 11:36:41 AM UTC-5, Anthony wrote: http://web2py.com/books/default/chapter/29/15/helping-web2py#Contributing-code-and-documentation-changes . But if that's too much for now, you can also email a patch file to Massimo. Anthony On Tuesday, February 11, 2014 11:31:16 AM UTC-5, User wrote: Possibly, I have never contributed to an open source project so I don't know what's involved. Are there instructions somewhere? On Tuesday, February 11, 2014 11:21:15 AM UTC-5, Massimo Di Pierro wrote: I agree. Can you submit a patch? On Tuesday, 11 February 2014 09:33:40 UTC-6, User wrote: Thanks, also seems like there should be the following test cases in \web2py\gluon\tests\test_validators.py def test_IS_TIME(self): rtn = IS_TIME()('12:00 am') self.assertEqual(rtn, (datetime.time(0, 0), None)) rtn = IS_TIME()('12:01 am') self.assertEqual(rtn, (datetime.time(0, 1), None)) rtn = IS_TIME()('12:00 pm') self.assertEqual(rtn, (datetime.time(12, 0), None)) On Tuesday, February 11, 2014 9:10:51 AM UTC-5, Massimo Di Pierro wrote: You are right. Now fixed in trunk. On Tuesday, 11 February 2014 01:57:25 UTC-6, User wrote: I have an input field on a form where users can enter a time in 12-hour format. Entering 12:00AM on this form seems to be getting interpreted as 12PM (debugging I can see the python time object is datetime.time(12, 0). Calling the validator directly in the web2py shell gives: rtn = IS_TIME()('12:00 am') (datetime.time(12, 0), None) Is this a bug? Shouldn't it return datetime.time(0, 0)? Also, seems a little odd that there are no test cases for midnight or noon in def test_IS_TIME(self) -- 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] possible bug with IS_TIME() midnight in 12 hour format?
I have an input field on a form where users can enter a time in 12-hour format. Entering 12:00AM on this form seems to be getting interpreted as 12PM (debugging I can see the python time object is datetime.time(12, 0). Calling the validator directly in the web2py shell gives: rtn = IS_TIME()('12:00 am') (datetime.time(12, 0), None) Is this a bug? Shouldn't it return datetime.time(0, 0)? Also, seems a little odd that there are no test cases for midnight or noon in def test_IS_TIME(self) -- 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] Can I specify a display name in emails sent via auth.settings.mailer?
I would like the from address of automated emails for user registration, retrieve password, etc to have a display name. How can I do this? Currently my mailer is defined similar to: mail = auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'i...@example.com' Can I do something like this? mail.settings.sender = 'Company Name i...@example.com''companyi...@example.com' I saw this related post: https://groups.google.com/forum/#!topic/web2py/GCY_jQusDKk but that is only discussing the mail.send() method I believe -- 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: Do I need to set auth.settings.hmac_key?
Should I create an issue for changes to the book? Or do you already have it notated? On Friday, January 31, 2014 12:55:51 PM UTC-5, Massimo Di Pierro wrote: It should be modified. On Thursday, 30 January 2014 11:35:08 UTC-6, User wrote: Ok I was confused because the books says ( http://www.web2py.com/book/default/chapter/09#Settings-and-messages) The following is a very important setting: auth.settings.hmac_key = None It must be set to something like sha512:a-pass-phrase and it will be passed to the CRYPT validator for the password field of the auth_usertable. It will be the algorithm and a-pass-phrase used to hash the passwords. Do you think the book should be modified to reflect that this is automatically done already? I see in a different section it says: The password field of the db.auth_user table defaults to a CRYPTvalidator, which needs and hmac_key. On legacy web2py applications you may see an extra argument passed to the Auth constructor: hmac_key = Auth.get_or_create_key(). The latter is a function that read the HMAC key from a file private/auth.key within the application folder. If the file does not exist it creates a random hmac_key. If multiple apps share the same auth database, make sure they also use the same hmac_key. This is no longer necessary for new applications since passwords are salted with an individual random salt. But it wasn't clear to me whether I should set it or not as the two sections kind of go against each other. On Thursday, January 30, 2014 8:42:37 AM UTC-5, Massimo Di Pierro wrote: This is really not necessary since we automatically salt and hash all passwords. On Tuesday, 28 January 2014 17:04:37 UTC-6, User wrote: Is best practice to set auth.settings.hmac_key='sha512:somelongpassword'? Or is this not necessary? And if I should do it, does it need to be done before auth.define_tables? -- 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: Do I need to set auth.settings.hmac_key?
Ok I was confused because the books says ( http://www.web2py.com/book/default/chapter/09#Settings-and-messages) The following is a very important setting: auth.settings.hmac_key = None It must be set to something like sha512:a-pass-phrase and it will be passed to the CRYPT validator for the password field of the auth_usertable. It will be the algorithm and a-pass-phrase used to hash the passwords. Do you think the book should be modified to reflect that this is automatically done already? I see in a different section it says: The password field of the db.auth_user table defaults to a CRYPT validator, which needs and hmac_key. On legacy web2py applications you may see an extra argument passed to the Auth constructor: hmac_key = Auth.get_or_create_key(). The latter is a function that read the HMAC key from a file private/auth.key within the application folder. If the file does not exist it creates a random hmac_key. If multiple apps share the same auth database, make sure they also use the same hmac_key. This is no longer necessary for new applications since passwords are salted with an individual random salt. But it wasn't clear to me whether I should set it or not as the two sections kind of go against each other. On Thursday, January 30, 2014 8:42:37 AM UTC-5, Massimo Di Pierro wrote: This is really not necessary since we automatically salt and hash all passwords. On Tuesday, 28 January 2014 17:04:37 UTC-6, User wrote: Is best practice to set auth.settings.hmac_key='sha512:somelongpassword'? Or is this not necessary? And if I should do it, does it need to be done before auth.define_tables? -- 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] request.is_local not working?
I'm using web2py on webfaction and as far as I can tell request.is_local is not working. I have a page that uses the generic.html view which has the following lines: {{if request.is_local:}} {{=response.toolbar()}} {{pass}} The web2py book says: request.is_local: True if the client is localhost, False otherwise. Should work behind a proxy if the proxy supports http_x_forwarded_for. Yet it still shows the toolbar when viewing my hosted site. Using the toolbar I can see that HTTP_X_FORWARDED_FOR is set to my personal computer ip address. Any ideas why this doesn't work? -- 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: Pattern-based Application-Specific URL rewrite basic example?
Happy to say this is now working. One thing I was wondering is if the application specific url rewriting could route at the root level or not (e.g. route www.example.com/someapp/default/contat to www.example.com/contact) or if it was limited to having an app prefix (e.g. only route www.example.com/someapp/default/contact to www.example.com/someapp/contact). Well I can confirm that it does not need an app prefix. Here's what I put in web2py-root/routes.py assuming my app's name is someapp: # -*- coding: utf-8 -*- # default_application, default_controller, default_function # are used when the respective element is missing from the # (possibly rewritten) incoming URL # default_application = 'someapp'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py # routes_app is a tuple of tuples. The first item in each is a regexp that will # be used to match the incoming request URL. The second item in the tuple is # an applicationname. This mechanism allows you to specify the use of an # app-specific routes.py. This entry is meaningful only in the base routes.py. # # Example: support welcome, admin, app and myapp, with myapp the default: routes_app = ((r'/(?Pappwelcome|admin|app|someapp)\b.*', r'\gapp'), (r'(.*)', r'someapp'), (r'/?(.*)', r'someapp')) other than that I left routes_in and routes_out alone. Then in my web2py-root/applications/someapp/routes.py I put: default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py BASE = '' # optonal prefix for incoming URLs routes_in = ( ('/(?Pfunctionabout|contact)', r'/someapp/default/\gfunction'), # remove the BASE prefix (BASE + '/$anything', '/$anything'), ) routes_out = ( (r'/$app/default/index', '/'), (r'/$app/default/$anything', '/$anything'), # restore the BASE prefix ('/$anything', BASE + '/$anything'), ) routes_onerror = [ (r'*/*', r'/someapp/default/handle_error') ] Not yet sure if the BASE stuff is necessary. Also can confirm error routing works in the app specific routes.py with no error routes specified in the main routing file. Note when I tried using the $app variable in routes_in as shown below it seemed to give a Rocket error routes_in = ( ('/(?Pfunctionabout|contact)', r'/$app/default/\gfunction'), # remove the BASE prefix (BASE + '/$anything', '/$anything'), ) I prefer the app specific routing because it makes it easy to version control your app's routes with your app's repository. On Tuesday, January 28, 2014 11:25:07 PM UTC-5, User wrote: My web2py-root/routes.py currently has: # -*- coding: utf-8 -*- # default_application, default_controller, default_function # are used when the respective element is missing from the # (possibly rewritten) incoming URL # default_application = 'init'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py # routes_app is a tuple of tuples. The first item in each is a regexp that will # be used to match the incoming request URL. The second item in the tuple is # an applicationname. This mechanism allows you to specify the use of an # app-specific routes.py. This entry is meaningful only in the base routes.py. # # Example: support welcome, admin, app and myapp, with myapp the default: routes_app = ((r'/(?Pappwelcome|admin|app)\b.*', r'\gapp'), (r'(.*)', r'myapp'), (r'/?(.*)', r'myapp')) ... For a basic example of routing www.example.com/someapp/default/contact to www.example.com/contact what needs to go in the web2py-root/routes.py and what needs to go in the web2py-root/applications/someapp/routes.py? If I'm using application specific routing does this mean I should leave routes_in and routes_out completely alone in web2py-root/routes.py? Also for specifying errors, do I use routes_onerror in web2py-root/routes.py or web2py-root/applications/someapp/routes.py? -- 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] How to change password Too short message?
When registering a new user using the default Auth forms, if the password entered is too short, an error message Too short is displayed. I would like to change this message to something more meaningful such as Password must be at least x characters 1. How do I do this? 2. Shouldn't the default message be something like this? Seems not user friendly to just say password Too short with no indication to the user how long a password should be. Are they just supposed to keep entering passwords until they hit whatever arbitrary password length we have set? Alternatively, is there a way to specify a permanent hint on the form that passwords must be x characters? -- 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] Location of auth.settings statements relative to auth.define_tables?
In the welcome application, all auth.settings statements appear after auth.define_tables statement: ## create all tables needed by auth if not custom tables auth.define_tables(username=False, signature=False) ## configure email mail = auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'y...@gmail.com' mail.settings.login = 'username:password' ## configure auth policy auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True However, some auth setting statement must occur before auth.define_tables in order to take effect (such as auth.settings.password_min_length). How do I know which ones need to come before or after auth.define_tables? Or can/should they all come before auth.define_tables? -- 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] Do I need to set auth.settings.hmac_key?
Is best practice to set auth.settings.hmac_key='sha512:somelongpassword'? Or is this not necessary? And if I should do it, does it need to be done before auth.define_tables? -- 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 change password Too short message?
Thanks, issue created: http://code.google.com/p/web2py/issues/detail?id=1863 On Tuesday, January 28, 2014 6:57:35 PM UTC-5, Anthony wrote: On Tuesday, January 28, 2014 4:46:27 PM UTC-5, User wrote: When registering a new user using the default Auth forms, if the password entered is too short, an error message Too short is displayed. I would like to change this message to something more meaningful such as Password must be at least x characters 1. How do I do this? db.auth_user.password.requires[0].error_message = 'Password must be at least x characters' 2. Shouldn't the default message be something like this? Seems not user friendly to just say password Too short with no indication to the user how long a password should be. Are they just supposed to keep entering passwords until they hit whatever arbitrary password length we have set? Yes, good idea. Please open an issue on Google Code. Alternatively, is there a way to specify a permanent hint on the form that passwords must be x characters? It would probably be a good idea to add this by default as well. You can do it manually via: db.auth_user.password.comment = 'Password must be...' 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] Blocking/lockout for excessive login attempts?
Does web2py have any ability to block too many login attempts from occurring perhaps by locking the user out? Or showing a captcha after x login tries? Or some other feature to mitigate brute force password attempts? -- 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] What is the purpose of the ABOUT file in an application?
In the welcome application there is an ABOUT file whose contents are: Write something about this app. Developed with web2py. What's the intended purpose of this file and is it protected from end users' viewing? Is this for developers? Also is the LICENSE file protected from end user viewing? -- 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] Pattern-based Application-Specific URL rewrite basic example?
My web2py-root/routes.py currently has: # -*- coding: utf-8 -*- # default_application, default_controller, default_function # are used when the respective element is missing from the # (possibly rewritten) incoming URL # default_application = 'init'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py # routes_app is a tuple of tuples. The first item in each is a regexp that will # be used to match the incoming request URL. The second item in the tuple is # an applicationname. This mechanism allows you to specify the use of an # app-specific routes.py. This entry is meaningful only in the base routes.py. # # Example: support welcome, admin, app and myapp, with myapp the default: routes_app = ((r'/(?Pappwelcome|admin|app)\b.*', r'\gapp'), (r'(.*)', r'myapp'), (r'/?(.*)', r'myapp')) ... For a basic example of routing www.example.com/someapp/default/contact to www.example.com/contact what needs to go in the web2py-root/routes.py and what needs to go in the web2py-root/applications/someapp/routes.py? If I'm using application specific routing does this mean I should leave routes_in and routes_out completely alone in web2py-root/routes.py? Also for specifying errors, do I use routes_onerror in web2py-root/routes.py or web2py-root/applications/someapp/routes.py? -- 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: RFC: validator IS_NOT_IN_SET
I think this is a useful validator, any chance this can end up in web2py? On Friday, August 9, 2013 4:13:30 PM UTC-4, Kyle Flanagan wrote: I had to use this today. However, this does not work correctly when the set is empty. We assume that if the set is empty, whatever variable value being tested is not in the set. Here's an updated __call__ function: def __call__(self, value): value, error = IS_IN_SET.__call__(self, value) # if IS_IN_SET says value was in the set AND the set isn't empty # then return an error if error == None and len(self.theset) 0: return (value, self.error_message) else: return (value, None) On Monday, August 23, 2010 9:19:48 AM UTC-5, Vidul Petrov wrote: Hi all, I needed IS_NOT_IN_SET validator and added it in my custom validators.py, do you think it is useful? class IS_NOT_IN_SET(IS_IN_SET): example:: INPUT(_type='text', _name='name', requires=IS_NOT_IN_SET(['max', 'john'],zero='')) the argument of IS_NOT_IN_SET must be a list or set IS_NOT_IN_SET(['max', 'john'])('max') ('max', 'value not allowed') IS_NOT_IN_SET(['max', 'john'])('na') ('na', None) IS_NOT_IN_SET(('id1','id2'), ['first label','second label'])('id100') ('id100', None) IS_NOT_IN_SET(('id1','id2'), ['first label','second label'])('id1') ('id1', 'value not allowed') IS_NOT_IN_SET(('id1','id2'), ['first label','second label'])('id2') ('id2', 'value not allowed') IS_NOT_IN_SET({'id1':'first label', 'id2':'second label'}) ('id100') ('id100', None) IS_NOT_IN_SET({'id1':'first label', 'id2':'second label'}) ('id1') ('id1', 'value not allowed') IS_NOT_IN_SET({'id1':'first label', 'id2':'second label'}) ('id2') ('id2', 'value not allowed') import itertools IS_NOT_IN_SET(itertools.chain(['1','3','5'],['2','4','6'])) ('100') ('100', None) IS_NOT_IN_SET(itertools.chain(['1','3','5'],['2','4','6'])) ('1') ('1', 'value not allowed') IS_NOT_IN_SET(itertools.chain(['1','3','5'],['2','4','6'])) ('6') ('6', 'value not allowed') IS_NOT_IN_SET(itertools.chain(['1','3','5'],['2','4','6'])) ('7') ('7', None) def __init__(self, *a, **b): IS_IN_SET.__init__(self, *a, **b) def __call__(self, value): value, error = IS_IN_SET.__call__(self, value) if error == None: return (value, self.error_message) else: return (value, None) -- 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] Getting a 400 bad request instead of 404 for urls with hyphens?
I am trying to get error handling for page not found errors working. I'm using the following example: http://www.web2pyslices.com/slice/show/1529/custom-error-routing This seems to be working for URLs such as www.example.com/asdf www.example.com/longurlthatdoesnotexit?_next=/ I get my 404 page. However as soon as I put a hyphen (or dash) in the URL www.example.com/as-df I get a 400 BAD REQUEST error and the page just says invalid request How can I fix this so it behaves as expected and returns a 404 error? -- 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] Minimum password length not working?
In the web2py book it says: By default, auth also requires a minimum password length of 4. This can be changed: auth.settings.password_min_length = 4 (from http://www.web2py.com/book/default/chapter/09#Settings-and-messages) So I tried changing to: auth.settings.password_min_length = 7 After web2py server restart this still allows registration with a password less than 7 characters (4 still seems to be the minimum). What am I missing? -- 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: What is the purpose of data-w2p_disable_with?
I see this is fixed in trunk now http://code.google.com/p/web2py/source/detail?r=ed705d58b82c0d2363b04e69256c9fe122434a37 thanks guys On Monday, January 20, 2014 5:39:59 PM UTC-5, Anthony wrote: It shouldn't be causing any problems, so you don't really *have* to remove it. Unfortunately, it is inserted by the .xml() method, so you can't just manipulate the A() object. Instead, you can do: {{=XML(A(...).xml().replace(' data-w2p_disable_with=default', ''))}} I suppose you could make a class that does that: class A2(A): def xml(self): return super(A2, self).xml().replace(' data-w2p_disable_with=default', '') Anyway, we should probably change the behavior of A() so it doesn't add that attribute when not needed. Anthony On Monday, January 20, 2014 2:22:17 PM UTC-5, User wrote: Anyone know how to remove it? I'm about to switch to using raw html instead of A helper but if someone knows a way to remove the data-w2p_disable_with attribute I'd rather do that. If there is not an official way perhaps there is a hack where I could redefine the A helper somehow On Saturday, January 4, 2014 1:25:43 AM UTC-5, User wrote: Good to know. How can I remove it for all my links? On Monday, December 30, 2013 8:18:11 PM UTC-5, Anthony wrote: That's so the link can be temporarily disabled (the text will be replaced with Working...) when it is used to trigger an Ajax request. However, I don't know why it's included in the anchor tag in all cases -- seems like it would only be needed when the cid, component, or callback arguments are used. Anthony On Monday, December 30, 2013 5:39:53 PM UTC-5, User wrote: Links I build with the anchor A html helper look like: a href=/myapp/mycontroller/view/5 data-w2p_disable_with=defaultAnchor Text/a What is the purpose of the data-w2p_disable_with = default attribute and how can I remove it? -- 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] Warning about using web2py URL rewrite?
http://www.web2py.com/AlterEgo/default/show/42 says: web2py supports URL rerwite although this is not really recommended. You should really use Apache (or lighttpd) + mod_proxy (or mod_rewrite) for this purpose. Moreover rewriting web2py urls can break links in applications. So *do not do it*. Anyway if you really really want to ... Is this a valid warning? Why might this be? And if apache mod_rewrite is better does anyone have a basic example for routing an application at www.example.com/someapp/default/index to www.example.com/ -- 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] URL-based languages for pattern-based routing?
I'm using pattern-based routing to meet some of my routing needs. How can I support URL-based languages (as described in http://www.web2py.com/book/default/chapter/04#Parameter-based-system) but with the pattern-based routing? -- 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: foreign key reference and not null mutually exclusive. by design, or a bug?
Thanks. Here is the issue in case anyone is interested: http://code.google.com/p/web2py/issues/detail?id=1395 On Wednesday, January 22, 2014 3:39:56 PM UTC-5, Anthony wrote: This is a bug, and an issue has been created. Yes, you should be able to make the change directly in the database. Anthony On Wednesday, January 22, 2014 1:13:30 PM UTC-5, User wrote: I also would like a non-null foreign key reference, but like OP experienced web2py will not create one (I'm using postgresql). Why is this? And is there a workaround to make reference fields not null? Or worst case can I add the not null constraint manually in the db without breaking anything? On Tuesday, June 19, 2012 11:40:37 AM UTC-4, Ivan wrote: Same problem here! The notnull=True parameter doesn't append the NOT NULL clause for reference fields. The IS_IN_DB function activates the check at form-level while the notnull parameter should set the constraint at db-level. -- 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: foreign key reference and not null mutually exclusive. by design, or a bug?
I also would like a non-null foreign key reference, but like OP experienced web2py will not create one. Why is this? And is there a workaround to make reference fields not null? Or worst case can I add the not null constraint manually in the db without breaking anything? On Tuesday, June 19, 2012 11:40:37 AM UTC-4, Ivan wrote: Same problem here! The notnull=True parameter doesn't append the NOT NULL clause for reference fields. The IS_IN_DB function activates the check at form-level while the notnull parameter should set the constraint at db-level. -- 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: What is the purpose of data-w2p_disable_with?
Anyone know how to remove it? I'm about to switch to using raw html instead of A helper but if someone knows a way to remove the data-w2p_disable_with attribute I'd rather do that. If there is not an official way perhaps there is a hack where I could redefine the A helper somehow On Saturday, January 4, 2014 1:25:43 AM UTC-5, User wrote: Good to know. How can I remove it for all my links? On Monday, December 30, 2013 8:18:11 PM UTC-5, Anthony wrote: That's so the link can be temporarily disabled (the text will be replaced with Working...) when it is used to trigger an Ajax request. However, I don't know why it's included in the anchor tag in all cases -- seems like it would only be needed when the cid, component, or callback arguments are used. Anthony On Monday, December 30, 2013 5:39:53 PM UTC-5, User wrote: Links I build with the anchor A html helper look like: a href=/myapp/mycontroller/view/5 data-w2p_disable_with=defaultAnchor Text/a What is the purpose of the data-w2p_disable_with = default attribute and how can I remove it? -- 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] Select scalar?
Is there a convenience method to select a scalar value from a database table? What I do currently is: db(db.customer.id == 5).select(db.customer.first_name).first().first_name If not would it make sense to add one? Seems like a reasonably common use case. Maybe something like db(db.customer.id == 5).scalar(db.customer.first_name) Not that big a difference but might be worthwhile. -- 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: Does migration from a 'string' field to a 'list:string' field preserve data?
I just tested this with a simple app using postgresql database and it seems that it doesn't quite work. It appears it will leave the string data that exists in the string field alone in the database, however web2py will interpret it such that the first and last character are truncated. For example: hello - ell something - omthin world - orl As soon as you add another list item to the string, then web2py will truncate the original string's first and last characters in the database in addition to adding the new item. Migration back from list:string to string will preserve whatever list:string data is there (in the web2py representation format). hello, world - |hello|world| one, two - |one|two| Would it make sense for the migration process to handle this more gracefully? On Monday, January 13, 2014 3:34:47 PM UTC-5, User wrote: Does a migration from a 'string' field to a 'list:string' field preserve string data that is already in the database and convert it to the format required by list:string? -- 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: SQLFORM and IS_IN_SET problem
Thanks good point about just modifying the db field directly to add pipe characters if migrating from string to list:string. I think in that case I will make my field a string field and migrate later if necessary. On Tuesday, January 14, 2014 9:48:53 AM UTC-5, Anthony wrote: On Tuesday, January 14, 2014 1:18:11 AM UTC-5, User wrote: So I tested the migration feature and string to list:string doesn't work. So we are left with the fact that a list:string field with IS_IN_SET multiple=False will not select the current value in an SQLFORM. Seems kind of like a bug to me, does anyone else think so? I wouldn't call it a bug. It's somewhat of an odd use case. Using IS_IN_SET with multiple=False gives you a non-multiple SELECT widget. Such a widget can have only a single option selected, so the web2py SELECT helper checks to see if the current value of the field is the same as any of the OPTION values. Because the current value of the list:string field is a list (and not an individual string), it will not match the value of any option values. Instead, you can just switch to a string field, and if you ever need to migrate, just wrap each string in pipe characters (i.e., |thestring|). Another option is to create a custom widget: Field('myfield', 'list:string', requires=IS_IN_SET(...), widget=mywidget) Finally, you can do: Field('myfield', 'list:string', requires=IS_IN_SET(..., multiple=(1, 1)), comment='Please select only one.') The above will show a multiple select box instead of a single-select drop-down, but it will require the user to select exactly one option (will return an error message otherwise). 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: Does migration from a 'string' field to a 'list:string' field preserve data?
For completeness and future reference this can also be done directly in SQL for example in postgresql: UPDATE your_table set some_field = '|' || some_field || '|'; On Tuesday, January 14, 2014 8:52:40 AM UTC-5, Anthony wrote: For now, if you want to do a migration, all you have to do is loop through the records and put a pipe character (|) before and after each string. Perhaps this can be automated -- you can submit an issue on Google Code. Anthony On Tuesday, January 14, 2014 1:21:52 AM UTC-5, User wrote: It appears it will leave the string data that exists in the string field alone in the database, however web2py will interpret it such that the first and last character are truncated. For example: hello - ell something - omethin world - orl As soon as you add another list item to the string, then web2py will overwrite the original string's first and last characters with pipe characters in the database in addition to adding the new item. Migration back from list:string to string will preserve whatever list:string data is there (in the web2py representation format). hello, world - |hello|world| one, two - |one|two| Would it make sense for the migration process to handle this more gracefully? On Monday, January 13, 2014 3:34:47 PM UTC-5, User wrote: Does a migration from a 'string' field to a 'list:string' field preserve string data that is already in the database and convert it to the format required by list:string? -- 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] Does migration from a 'string' field to a 'list:string' field preserve data?
Does a migration from a 'string' field to a 'list:string' field preserve string data that is already in the database and convert it to the format required by list:string? -- 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: Does migration from a 'string' field to a 'list:string' field preserve data?
I just test this with a simple app using SQLite database and it seems that it doesn't quite work. It appears it will truncate the string data that exists in the string field. Specifically it will remove the first and last character of whatever is in the string field. For example: hello - ell something - omthin world - orl Migration back from list:string to string will preserve the existing list:string data in the web2py representation: hello, world - |hello|world| one, two - |one|two| On Monday, January 13, 2014 3:34:47 PM UTC-5, User wrote: Does a migration from a 'string' field to a 'list:string' field preserve string data that is already in the database and convert it to the format required by list:string? -- 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: SQLFORM and IS_IN_SET problem
So I tested the migration feature and string to list:string doesn't work. So we are left with the fact that a list:string field with IS_IN_SET multiple=False will not select the current value in an SQLFORM. Seems kind of like a bug to me, does anyone else think so? On Tuesday, January 7, 2014 8:08:13 PM UTC-5, User wrote: I have the same problem as the original poster. I am only storing a single value as of now but I'm using list:string instead of string so that if I change my mind to allow multiple values it will be easier to transition. Is this a bug that it won't preselect the selected value? Alternatively, does migration from a string field to a list:string field preserve the string data? On Monday, October 10, 2011 7:20:46 PM UTC-4, Anthony wrote: On Monday, October 10, 2011 6:01:49 PM UTC-4, Cliff wrote: Mostly fixed now. There was also a bug in my controller code that was complicating things. One problem remains. With readonly=True, the field still shows the dictionary key rather than the value. With readonly, I guess it's not using the widget, so it will just show the value stored in the field itself. Maybe you can define a represent function for the field so it shows the label associated with the value. 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: Does migration from a 'string' field to a 'list:string' field preserve data?
It appears it will leave the string data that exists in the string field alone in the database, however web2py will interpret it such that the first and last character are truncated. For example: hello - ell something - omethin world - orl As soon as you add another list item to the string, then web2py will overwrite the original string's first and last characters with pipe characters in the database in addition to adding the new item. Migration back from list:string to string will preserve whatever list:string data is there (in the web2py representation format). hello, world - |hello|world| one, two - |one|two| Would it make sense for the migration process to handle this more gracefully? On Monday, January 13, 2014 3:34:47 PM UTC-5, User wrote: Does a migration from a 'string' field to a 'list:string' field preserve string data that is already in the database and convert it to the format required by list:string? -- 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: Data Fixtures
I have the same question. Is there any update on this almost 2 years later? On Thursday, March 8, 2012 4:32:45 PM UTC-5, Bruce Wade wrote: Hi, I have seen lots of postings about people wanting to pre-load data (fixtures) in web2py. However I have never found a standard solution. What are the best practices? Also before someone suggests putting them in the models directory I don't think that is a good idea. I would prefer something more like django where we can run a command to load the fixtures whenever we want. IE: python web2py.py -f fixtures_path or file -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com -- 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: Debugging with the scheduler
For future reference just adding the fact that you can open a web2py shell and call your scheduler tasks directly in order to debug them. This wasn't obvious to me but is much easier than trying to run the scheduler and debug it via logging statements. For example: python web2py.py -M -S your_app_name and then call a function from your scheduler.py file which will just be a global function (that is, just type the function name at the shell prompt). Inside your function you can set a pdb break point and debug to your heart's content. scheduler.py: def myfunction(): import pdb; pdb.set_trace() ... On Wednesday, February 27, 2013 4:36:10 PM UTC-5, José L. wrote: 2013/2/26 Niphlod nip...@gmail.com javascript:: never done it, but debugging a multiprocessing spawned process needs additional tuning http://pydev.org/manual_adv_remote_debugger.html PS: can I ask what is not working ? if it's a focused problem maybe I can come up with an answer . I've fixed it , it was a problem with a locked file when using shelve. I've used a workaround but I don't feel happy with the solution (it works but's terribly ugly). Any idea to exchange a big Python list with data between the main web2py application and the long-lasting backgroud process is welcome. Regards. On Tuesday, February 26, 2013 9:12:23 PM UTC+1, José L. wrote: Hello, I'm working with async processes using the scheduler (with the unvaluable help of the learn by trial application from Niphlod. I wonder if there's an easy way to debug the processes that are being executed in the background (I'm having problems with them, they work ok when run from web2py directly as a normal process, but not when they're executed by the scheduler). Pdb would be great, but if not, is there any way to use the ugly but useful print vars commands to see the flow of execution of the tasks? I know of the output field in the scheduler_task table in the database, but that's terribly slow Regards. José L. -- --- 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: Scheduler: Error retrieving status?
postgresql. Also my app which uses same database works and I can see the tables and the row in scheduler_task table from appadmin On Friday, January 10, 2014 9:57:25 AM UTC-5, Niphlod wrote: what db are you using ? that error usually pops up when the scheduler can't access the scheduler_* tables. On Friday, January 10, 2014 2:09:26 AM UTC+1, User wrote: I'm just getting started with the scheduler and I'm getting an error when I start it on windows 7: C:\www\web2pypython web2py.py -K my_app web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2014 Version 2.8.2-stable+timestamp.2013.12.09.17.54.55 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL( psycopg2 ), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyod bc), IMAP(imaplib) starting single-scheduler for my_app... ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status This error just continually repeats until I ctrl-c. Here is my scheduler.py: # coding: utf8 def doit(): print 'hello world' tasks = dict( doit=doit, ) from gluon.scheduler import Scheduler scheduler = Scheduler(db, tasks) I created a single row in the scheduler_task table. What is causing this error? How do I begin to debug this? (Note when browsing my site there are no errors). -- 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: Scheduler: Error retrieving status?
I created a bare bones app and the scheduler seems to work without error. Not really sure what's happening with the problem app but if I had to guess I'm thinking it might be related to using db._common_fields.append(standard_fields) where standard_fields is a table with fields such as date_created, created_by, modified_by etc. which in turn has defaults like auth.user_id. Unexpected by me, these got appended to the scheduler tables. Maybe there is some problematic interaction with this. I'm going to try explicitly adding standard_fields to my app tables rather than using db._common_fields.append to see if that fixes it. On Friday, January 10, 2014 10:53:22 AM UTC-5, User wrote: postgresql. Also my app which uses same database works and I can see the tables and the row in scheduler_task table from appadmin On Friday, January 10, 2014 9:57:25 AM UTC-5, Niphlod wrote: what db are you using ? that error usually pops up when the scheduler can't access the scheduler_* tables. On Friday, January 10, 2014 2:09:26 AM UTC+1, User wrote: I'm just getting started with the scheduler and I'm getting an error when I start it on windows 7: C:\www\web2pypython web2py.py -K my_app web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2014 Version 2.8.2-stable+timestamp.2013.12.09.17.54.55 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL( psycopg2 ), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyod bc), IMAP(imaplib) starting single-scheduler for my_app... ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status This error just continually repeats until I ctrl-c. Here is my scheduler.py: # coding: utf8 def doit(): print 'hello world' tasks = dict( doit=doit, ) from gluon.scheduler import Scheduler scheduler = Scheduler(db, tasks) I created a single row in the scheduler_task table. What is causing this error? How do I begin to debug this? (Note when browsing my site there are no errors). -- 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: Scheduler: Error retrieving status?
Ok that appears to have been the problem. Getting rid of db._common_fields.append(standard_fields) fixed it. Didn't hone in on the exact problem but maybe it's because I had not null on created_by, modified_by fields which defaulted to auth.user_id. Does a scheduled task even have a concept of a logged in user? On Friday, January 10, 2014 7:07:32 PM UTC-5, User wrote: I created a bare bones app and the scheduler seems to work without error. Not really sure what's happening with the problem app but if I had to guess I'm thinking it might be related to using db._common_fields.append(standard_fields) where standard_fields is a table with fields such as date_created, created_by, modified_by etc. which in turn has defaults like auth.user_id. Unexpected by me, these got appended to the scheduler tables. Maybe there is some problematic interaction with this. I'm going to try explicitly adding standard_fields to my app tables rather than using db._common_fields.append to see if that fixes it. On Friday, January 10, 2014 10:53:22 AM UTC-5, User wrote: postgresql. Also my app which uses same database works and I can see the tables and the row in scheduler_task table from appadmin On Friday, January 10, 2014 9:57:25 AM UTC-5, Niphlod wrote: what db are you using ? that error usually pops up when the scheduler can't access the scheduler_* tables. On Friday, January 10, 2014 2:09:26 AM UTC+1, User wrote: I'm just getting started with the scheduler and I'm getting an error when I start it on windows 7: C:\www\web2pypython web2py.py -K my_app web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2014 Version 2.8.2-stable+timestamp.2013.12.09.17.54.55 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL (psycopg2 ), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyod bc), IMAP(imaplib) starting single-scheduler for my_app... ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status This error just continually repeats until I ctrl-c. Here is my scheduler.py: # coding: utf8 def doit(): print 'hello world' tasks = dict( doit=doit, ) from gluon.scheduler import Scheduler scheduler = Scheduler(db, tasks) I created a single row in the scheduler_task table. What is causing this error? How do I begin to debug this? (Note when browsing my site there are no errors). -- 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] Scheduler: Error retrieving status?
I'm just getting started with the scheduler and I'm getting an error when I start it on windows 7: C:\www\web2pypython web2py.py -K my_app web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2014 Version 2.8.2-stable+timestamp.2013.12.09.17.54.55 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL( psycopg2 ), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres( pyod bc), IMAP(imaplib) starting single-scheduler for my_app... ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status ERROR:web2py.scheduler.mycomputer#10144:Error retrieving status This error just continually repeats until I ctrl-c. Here is my scheduler.py: # coding: utf8 def doit(): print 'hello world' tasks = dict( doit=doit, ) from gluon.scheduler import Scheduler scheduler = Scheduler(db, tasks) I created a single row in the scheduler_task table. What is causing this error? How do I begin to debug this? (Note when browsing my site there are no errors). -- 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: SQLFORM and IS_IN_SET problem
I have the same problem as the original poster. I am only storing a single value as of now but I'm using list:string instead of string so that if I change my mind to allow multiple values it will be easier to transition. Is this a bug that it won't preselect the selected value? Alternatively, does migration from a string field to a list:string field preserve the string data? On Monday, October 10, 2011 7:20:46 PM UTC-4, Anthony wrote: On Monday, October 10, 2011 6:01:49 PM UTC-4, Cliff wrote: Mostly fixed now. There was also a bug in my controller code that was complicating things. One problem remains. With readonly=True, the field still shows the dictionary key rather than the value. With readonly, I guess it's not using the widget, so it will just show the value stored in the field itself. Maybe you can define a represent function for the field so it shows the label associated with the value. 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: Virtual field for latitude and longitude from geometry field?
Didn't realize you could make a second query in a Virtual field but makes sense now that I see it. Although I'd rather not make the extra query (2 actually since longitude would need to do the same thing) so I guess I will just add latitude and longitude directly to my original select instead of trying to make them Virtual fields. e.g. db(db.location.id0).select(db.location.ALL, db.location.point.st_x(), db. location.point.st_y()) On Friday, January 3, 2014 4:16:57 AM UTC-5, Paolo Valleri wrote: st_*() are db engine functions, you should query the db to get the output you are looking for. Given that, in your virtual field you should make a new query, something like that: Field.Virtual('latitude', lambda row: db(db.location.id == row.location.id ).select(db.location.point.st_x()).first()[db.location.point.st_x()] Paolo On Thursday, January 2, 2014 9:59:14 PM UTC+1, Christian Foster Howes wrote: i bet that by the time your lambda is running the point has been converted to a string already. can you see if that is true? i'm not sure how to invoke db functions in a lambda of a virtual field. :( On Wednesday, January 1, 2014 5:50:54 PM UTC-8, User wrote: Suppose I have a table like: db.define_table('location', Field(name, 'string'), Field('point', 'geometry()') ) I want to have the latitude and longitude as attributes also (whose value can be derived from the point field). So I try this: db.define_table('location', Field(name, 'string'), Field('point', 'geometry()'), Field.Virtual('latitude', lambda row: row.location.point.st_x()), Field.Virtual('longitude', lambda row: row.location.point.st_y()), ) But it doesn't work and fails silently. The model just doesn't have latitude or longitude fields. I also tried with Field.Method but this complains that 'point' is of typer str. I guess the complication is that st_x() translates into a database function. I'm thinking about parsing the point string which is of the form POINT(x y) as a workaround but I'd rather use st_x if someone can show me how. -- 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: What is the purpose of data-w2p_disable_with?
Good to know. How can I remove it for all my links? On Monday, December 30, 2013 8:18:11 PM UTC-5, Anthony wrote: That's so the link can be temporarily disabled (the text will be replaced with Working...) when it is used to trigger an Ajax request. However, I don't know why it's included in the anchor tag in all cases -- seems like it would only be needed when the cid, component, or callback arguments are used. Anthony On Monday, December 30, 2013 5:39:53 PM UTC-5, User wrote: Links I build with the anchor A html helper look like: a href=/myapp/mycontroller/view/5 data-w2p_disable_with=defaultAnchor Text/a What is the purpose of the data-w2p_disable_with = default attribute and how can I remove it? -- 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 all fields plus a calculated field?
My workaround is to change this: location = db(db.location.id == loc_id).select(db.location.ALL, db.location.point.st_x(). with_alias('latitude'), db.location.point.st_y(). with_alias('longitude')).first() into this: row = db(db.location.id == loc_id).select(db.location.ALL, db.location.point.st_x(). with_alias('latitude'), db.location.point.st_y(). with_alias('longitude')).first() location = row.location location.latitude = row.latitude location.longitude = row.longitude It works but it's a little kludgy as far as I'm concerned. Anyone have a cleaner solution? On Tuesday, December 31, 2013 7:00:10 PM UTC-5, User wrote: What is the proper way to select all fields plus a few additional calculated fields? Here is my basic query with no calculated field location = db(db.location.id == loc_id).select().first() This query returns location as a class 'gluon.dal.Row' object with fields for the location table as attributes. With this I can access location.address for example. Now to add calculated fields to get the geo spatial coordinates from the point field, I'm trying this: location = db(db.location.id == loc_id).select(db.location.ALL, db.location.point.st_x(). with_alias('latitude'), db.location.point.st_y(). with_alias('longitude')).first() Is this the proper way? This returns a class 'gluon.dal.Row' object with a location field (which is in turn also a Row object) and latitude and longitude fields. Now in order to access the address field I must do location.location.address How can make it so I can access the fields like location.address and location.latitude? -- 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] Virtual field for latitude and longitude from geometry field?
Suppose I have a table like: db.define_table('location', Field(name, 'string'), Field('point', 'geometry()') ) I want to have the latitude and longitude as attributes also (whose value can be derived from the point field). So I try this: db.define_table('location', Field(name, 'string'), Field('point', 'geometry()'), Field.Virtual('latitude', lambda row: row.location.point.st_x()), Field.Virtual('longitude', lambda row: row.location.point.st_y()), ) But it doesn't work and fails silently. The model just doesn't have latitude or longitude fields. I also tried with Field.Method but this complains that 'point' is of typer str. I guess the complication is that st_x() translates into a database function. I'm thinking about parsing the point string which is of the form POINT(x y) as a workaround but I'd rather use st_x if someone can show me how. -- 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] Select all fields plus a calculated field?
What is the proper way to select all fields plus a few additional calculated fields? Here is my basic query with no calculated field location = db(db.location.id == loc_id).select().first() This query returns location as a class 'gluon.dal.Row' object with fields for the location table as attributes. With this I can access location.address for example. Now to add calculated fields to get the geo spatial coordinates from the point field, I'm trying this: location = db(db.location.id == loc_id).select(db.location.ALL, db.location.point.st_x(). with_alias('latitude'), db.location.point.st_y(). with_alias('longitude')).first() Is this the proper way? This returns a class 'gluon.dal.Row' object with a location field (which is in turn also a Row object) and latitude and longitude fields. Now in order to access the address field I must do location.location.address How can make it so I can access the fields like location.address and location.latitude? -- 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] What is the purpose of data-w2p_disable_with?
Links I build with the anchor A html helper look like: a href=/myapp/mycontroller/view/5 data-w2p_disable_with=defaultAnchor Text/a What is the purpose of the data-w2p_disable_with = default attribute and how can I remove it? -- 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] SQLFORM.factory defaults?
I'm creating a form that is not based on a database table. I understand I can add a default to a field created with SQLFORM.factory, for example: form = SQLFORM.factory( Field('name', 'string', default='John'), ... is it possible to specify a default after the above statement has executed? For example something like this: form = SQLFORM.factory( Field('name', 'string'), ... form.something.name.default = 'John' Or is the only way to specify a default in the Field constructor? The reason I ask is because I have some logic involved in determining the default value (of course I can think of a workaround but I'm just curious) -- 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: Spatial/GIS: find records within X distance of point?
Thanks. This is what I see at line 2983 in dal.py: def ST_DWITHIN(self, first, second): http://postgis.org/docs/ST_Within.html return 'ST_DWithin(%s,%s)' %(self.expand(first), self.expand(second, first.type)) The proper documentation is at http://postgis.org/docs/ST_DWithin.html (note the 'D'). Also looks like this is missing the 3rd argument to ST_DWithin: boolean *ST_DWithin*(geometry g1, geometry g2, double precision distance_of_srid); On Sunday, December 8, 2013 9:25:35 AM UTC-5, Massimo Di Pierro wrote: Added ST_Dwithin support in trunk. Please check it. On Sunday, 8 December 2013 07:02:06 UTC-6, User wrote: I'm storing latitude/longitude coordinates in a geometry field (using PostgreSQL 9.1.10): Field('point', 'geometry()') I understand there is also the geography type but from my reading geometry is faster and is suitable for small distances ( http://workshops.boundlessgeo.com/postgis-intro/geography.html#why-not-use-geography ) I want users to be able to specify a reference point and search for all records within X distance from the reference point. Using raw SQL I would use ST_DWithin http://postgis.refractions.net/docs/ST_DWithin.html doing something like SELECT name, ST_AsText(point) FROM mytable WHERE ST_DWithin(point, ST_GeomFromText('POINT(40.47112 -76.33)',4326), 0.1) But web2py does not seem to support ST_DWithin only st_within. So how can I achieve a similar result in 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.
[web2py] Re: Spatial/GIS: find records within X distance of point?
Forgive me because I don't understand anything about the internals of web2py but doesn't REPLACE take three parameters: def REPLACE(self, first, (second, third)): return 'REPLACE(%s,%s,%s)' % (self.expand(first,'string'), self.expand(second,'string'), self.expand(third,'string')) Also: def ST_ASGEOJSON(self, first, second): http://postgis.org/docs/ST_AsGeoJSON.html return 'ST_AsGeoJSON(%s,%s,%s,%s)' %(second['version'], self.expand(first), second['precision'], second['options']) Or do you mean something different? On Monday, December 9, 2013 4:45:27 PM UTC-5, Massimo Di Pierro wrote: OK. This needs more work than anticipated. Looks like the Query object only supports unary and binary operators. Give me a little more time. ;-) On Monday, 9 December 2013 12:21:37 UTC-6, User wrote: Thanks. This is what I see at line 2983 in dal.py: def ST_DWITHIN(self, first, second): http://postgis.org/docs/ST_Within.html return 'ST_DWithin(%s,%s)' %(self.expand(first), self.expand(second, first.type)) The proper documentation is at http://postgis.org/docs/ST_DWithin.html (note the 'D'). Also looks like this is missing the 3rd argument to ST_DWithin: boolean *ST_DWithin*(geometry g1, geometry g2, double precision distance_of_srid); On Sunday, December 8, 2013 9:25:35 AM UTC-5, Massimo Di Pierro wrote: Added ST_Dwithin support in trunk. Please check it. On Sunday, 8 December 2013 07:02:06 UTC-6, User wrote: I'm storing latitude/longitude coordinates in a geometry field (using PostgreSQL 9.1.10): Field('point', 'geometry()') I understand there is also the geography type but from my reading geometry is faster and is suitable for small distances ( http://workshops.boundlessgeo.com/postgis-intro/geography.html#why-not-use-geography ) I want users to be able to specify a reference point and search for all records within X distance from the reference point. Using raw SQL I would use ST_DWithin http://postgis.refractions.net/docs/ST_DWithin.html doing something like SELECT name, ST_AsText(point) FROM mytable WHERE ST_DWithin(point, ST_GeomFromText('POINT(40.47112 -76.33)',4326), 0.1) But web2py does not seem to support ST_DWithin only st_within. So how can I achieve a similar result in 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.
[web2py] Re: Spatial/GIS: find records within X distance of point?
Thanks, on line 2987 I believe the format string is missing the 3rd '%s' parameter: return 'ST_DWithin(%s,%s)' %(self.expand(first), self.expand(second, first.type), self.expand(third, 'double')) Should be: return 'ST_DWithin(%s,%s,%s)' %(self.expand(first), self.expand(second, first.type), self.expand(third, 'double')) On Monday, December 9, 2013 6:06:32 PM UTC-5, Massimo Di Pierro wrote: Actually you do understand a lot of about this. That's a trick. It works. We can use it in this case too, until we come up with a better design. I used the same trick as in REPLACE, in trunk. Please give it a try. Massimo On Monday, 9 December 2013 16:33:09 UTC-6, User wrote: Forgive me because I don't understand anything about the internals of web2py but doesn't REPLACE take three parameters: def REPLACE(self, first, (second, third)): return 'REPLACE(%s,%s,%s)' % (self.expand(first,'string'), self.expand(second,'string'), self.expand(third,'string')) Also: def ST_ASGEOJSON(self, first, second): http://postgis.org/docs/ST_AsGeoJSON.html return 'ST_AsGeoJSON(%s,%s,%s,%s)' %(second['version'], self.expand(first), second['precision'], second['options']) Or do you mean something different? On Monday, December 9, 2013 4:45:27 PM UTC-5, Massimo Di Pierro wrote: OK. This needs more work than anticipated. Looks like the Query object only supports unary and binary operators. Give me a little more time. ;-) On Monday, 9 December 2013 12:21:37 UTC-6, User wrote: Thanks. This is what I see at line 2983 in dal.py: def ST_DWITHIN(self, first, second): http://postgis.org/docs/ST_Within.html return 'ST_DWithin(%s,%s)' %(self.expand(first), self.expand(second, first.type)) The proper documentation is at http://postgis.org/docs/ST_DWithin.html (note the 'D'). Also looks like this is missing the 3rd argument to ST_DWithin: boolean *ST_DWithin*(geometry g1, geometry g2, double precision distance_of_srid); On Sunday, December 8, 2013 9:25:35 AM UTC-5, Massimo Di Pierro wrote: Added ST_Dwithin support in trunk. Please check it. On Sunday, 8 December 2013 07:02:06 UTC-6, User wrote: I'm storing latitude/longitude coordinates in a geometry field (using PostgreSQL 9.1.10): Field('point', 'geometry()') I understand there is also the geography type but from my reading geometry is faster and is suitable for small distances ( http://workshops.boundlessgeo.com/postgis-intro/geography.html#why-not-use-geography ) I want users to be able to specify a reference point and search for all records within X distance from the reference point. Using raw SQL I would use ST_DWithinhttp://postgis.refractions.net/docs/ST_DWithin.html doing something like SELECT name, ST_AsText(point) FROM mytable WHERE ST_DWithin(point, ST_GeomFromText('POINT(40.47112 -76.33)',4326), 0.1) But web2py does not seem to support ST_DWithin only st_within. So how can I achieve a similar result in 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.
[web2py] Re: Spatial/GIS: find records within X distance of point?
This appears to be working correctly now thank you. One more thing: the docstring on line 2985 is referencing the wrong PostGIS function (ST_Within), it should be: http://postgis.org/docs/ST_DWithin.html (note the D) On Monday, December 9, 2013 6:54:53 PM UTC-5, Massimo Di Pierro wrote: You are right. Please check again. On Monday, 9 December 2013 17:16:17 UTC-6, User wrote: Thanks, on line 2987 I believe the format string is missing the 3rd '%s' parameter: return 'ST_DWithin(%s,%s)' %(self.expand(first), self.expand(second, first.type), self.expand(third, 'double')) Should be: return 'ST_DWithin(%s,%s,%s)' %(self.expand(first), self.expand(second, first.type), self.expand(third, 'double')) On Monday, December 9, 2013 6:06:32 PM UTC-5, Massimo Di Pierro wrote: Actually you do understand a lot of about this. That's a trick. It works. We can use it in this case too, until we come up with a better design. I used the same trick as in REPLACE, in trunk. Please give it a try. Massimo On Monday, 9 December 2013 16:33:09 UTC-6, User wrote: Forgive me because I don't understand anything about the internals of web2py but doesn't REPLACE take three parameters: def REPLACE(self, first, (second, third)): return 'REPLACE(%s,%s,%s)' % (self.expand(first,'string'), self.expand(second,'string'), self.expand(third,'string')) Also: def ST_ASGEOJSON(self, first, second): http://postgis.org/docs/ST_AsGeoJSON.html return 'ST_AsGeoJSON(%s,%s,%s,%s)' %(second['version'], self.expand(first), second['precision'], second['options']) Or do you mean something different? On Monday, December 9, 2013 4:45:27 PM UTC-5, Massimo Di Pierro wrote: OK. This needs more work than anticipated. Looks like the Query object only supports unary and binary operators. Give me a little more time. ;-) On Monday, 9 December 2013 12:21:37 UTC-6, User wrote: Thanks. This is what I see at line 2983 in dal.py: def ST_DWITHIN(self, first, second): http://postgis.org/docs/ST_Within.html return 'ST_DWithin(%s,%s)' %(self.expand(first), self.expand(second, first.type)) The proper documentation is at http://postgis.org/docs/ST_DWithin.html (note the 'D'). Also looks like this is missing the 3rd argument to ST_DWithin: boolean *ST_DWithin*(geometry g1, geometry g2, double precision distance_of_srid); On Sunday, December 8, 2013 9:25:35 AM UTC-5, Massimo Di Pierro wrote: Added ST_Dwithin support in trunk. Please check it. On Sunday, 8 December 2013 07:02:06 UTC-6, User wrote: I'm storing latitude/longitude coordinates in a geometry field (using PostgreSQL 9.1.10): Field('point', 'geometry()') I understand there is also the geography type but from my reading geometry is faster and is suitable for small distances ( http://workshops.boundlessgeo.com/postgis-intro/geography.html#why-not-use-geography ) I want users to be able to specify a reference point and search for all records within X distance from the reference point. Using raw SQL I would use ST_DWithinhttp://postgis.refractions.net/docs/ST_DWithin.html doing something like SELECT name, ST_AsText(point) FROM mytable WHERE ST_DWithin(point, ST_GeomFromText('POINT(40.47112 -76.33)',4326), 0.1) But web2py does not seem to support ST_DWithin only st_within. So how can I achieve a similar result in 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.
[web2py] Spatial/GIS: find records within X distance of point?
I'm storing latitude/longitude coordinates in a geometry field (using PostgreSQL 9.1.10): Field('point', 'geometry()') I understand there is also the geography type but from my reading geometry is faster and is suitable for small distances ( http://workshops.boundlessgeo.com/postgis-intro/geography.html#why-not-use-geography ) I want users to be able to specify a reference point and search for all records within X distance from the reference point. Using raw SQL I would use ST_DWithin http://postgis.refractions.net/docs/ST_DWithin.html doing something like SELECT name, ST_AsText(point) FROM mytable WHERE ST_DWithin(point, ST_GeomFromText('POINT(40.47112 -76.33)',4326), 0.1) But web2py does not seem to support ST_DWithin only st_within. So how can I achieve a similar result in 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.
[web2py] Re: sqlform.grid with div instead of html tables
That's what I was thinking also but I wanted to make sure I wasn't missing some hidden capability of web2py On Wednesday, November 20, 2013 6:53:21 AM UTC-5, Niphlod wrote: do it in your own views. altering all the markup of the grid and break it down to do what you're asking it's just asking for disasters at any new release of the grid's code (and lots of cpu wasted for nothing) On Wednesday, November 20, 2013 3:11:51 AM UTC+1, User wrote: This sounds like what I'm looking for. Currently I'm manually creating a list display by having a for loop in the view to spit out li items. However I'm wondering if I can use sqlform.grid to replace the custom ul list. 1. Is this expected usage of sqlform.grid or is this more of a hack? 2. Can someone give a very basic example of what myformat function might look like? mydisplay = myformat(grid.rows) grid.element('.web2py_table', replace=mydisplay) On Saturday, September 21, 2013 12:34:51 AM UTC-4, ssuresh wrote: Hi, I want to use sqlform.grid and all its features, but do not want the display in a tabular format. Is there a way in which I can change the display of sqlform.grid to my custom div instead of table. I tried doing some formatting on grid.rows mydisplay = myformat(grid.rows) grid.element('.web2py_table', replace=mydisplay) but still the resultant output is displayed within a table. Is there any alternatives? Any help would be greatly appreciated. thanx, Suresh -- 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: Updating auth.user extra_fields?
So am I correct in that in order to update the page size I would need to both update the database and also update the variable in the current session? That is, the following is necessary: db(db.auth_user.id == auth.user.id).update(pagesize=100) auth.user.pagesize = 100 On Tuesday, November 19, 2013 7:28:33 AM UTC-5, Eduardo Cruz wrote: db(db.auth_user.id == auth.user.id).update(pagesize=100) it will update the database. El martes, 19 de noviembre de 2013 03:38:40 UTC-4, User escribió: I want to store user page size preference for when there is a list view of items that needs pagination and have that preference persist between logins. Two questions about this: 1. I decided to add an extra field to my auth.table. Is this the best place to store this type of data? auth.settings.extra_fields['auth_user'] = [Field('pagesize','integer')] 2. If I want to update that setting how do I do it? auth.user.pagesize = 100 seems to adjust the pagesize for the current session but does not seem to affect the db. -- 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: sqlform.grid with div instead of html tables
This sounds like what I'm looking for. Currently I'm manually creating a list display by having a for loop in the view to spit out li items. However I'm wondering if I can use sqlform.grid to replace the custom ul list. 1. Is this expected usage of sqlform.grid or is this more of a hack? 2. Can someone give a very basic example of what myformat function might look like? mydisplay = myformat(grid.rows) grid.element('.web2py_table', replace=mydisplay) On Saturday, September 21, 2013 12:34:51 AM UTC-4, ssuresh wrote: Hi, I want to use sqlform.grid and all its features, but do not want the display in a tabular format. Is there a way in which I can change the display of sqlform.grid to my custom div instead of table. I tried doing some formatting on grid.rows mydisplay = myformat(grid.rows) grid.element('.web2py_table', replace=mydisplay) but still the resultant output is displayed within a table. Is there any alternatives? Any help would be greatly appreciated. thanx, Suresh -- 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: Updating auth.user extra_fields?
This topic seems to discuss a similar issue: https://groups.google.com/d/topic/web2py/_DDXJL7fwLk/discussion The answer seems to be yes you have to manually update the version in session as well as the database if you want the information to be synchronized. Using an after_update hook was discussed as a possible workaround. On Tuesday, November 19, 2013 2:38:40 AM UTC-5, User wrote: I want to store user page size preference for when there is a list view of items that needs pagination and have that preference persist between logins. Two questions about this: 1. I decided to add an extra field to my auth.table. Is this the best place to store this type of data? auth.settings.extra_fields['auth_user'] = [Field('pagesize','integer')] 2. If I want to update that setting how do I do it? auth.user.pagesize = 100 seems to adjust the pagesize for the current session but does not seem to affect the db. -- 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.