[web2py] Custom search function in GRID does not work anymore in R-2.18.5?
I have some old code that uses a custom search function in a sqlform.grid - something along the lines: def process_filtered(sfields, keywords): search_query = SQLFORM.build_query(sfields, keywords) [...] return search_query grid = SQLFORM.grid(db.doc_scan_details, searchable=process_filtered) It used to work fine on older versions of web2py, but when I updated to 2.18.5 it does not work anymore - i.e., the search function does not seem to be called. Why? -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/480314c1-06f6-4882-aa55-616fa4b31e48%40googlegroups.com.
Re: [web2py] Re: Flash messages not showing correctly
Thanks... It is just this 'tweaking' that I am worried about... It is not always easy to test every functionality of the page to make sure that I have done all the tweaking necessary... Thanks anyway. Krzysztof. On Tue, May 3, 2016 at 5:58 PM, Anthony wrote: > For the most part, you would replace the files in the scaffolding app that > are not customizable (i.e., web2py.js, web2py_ajax.html, appadmin.py, > appadmin.html, the generic views, etc.). In some cases, you may also need > to tweak layout.html, but that depends on how much of its original > functionality you retained. > > Anthony > > > On Tuesday, May 3, 2016 at 11:47:26 AM UTC-4, Krzysztof Socha wrote: >> >> Worked! Thanks! >> >> BTW: I keep running into issues when updating old web2py applications to >> new releases of web2py... Is there a recommended way of doing it? It is not >> very clear which files in my application folder should be >> changed/replaced/updated/edited when updating web2py. >> >> Krzysztof. >> >> On Tuesday, May 3, 2016 at 5:31:52 PM UTC+2, Anthony wrote: >>> >>> In layout.html, have you tried changing the class of the flash div from >>> "flash" to "w2p_flash"? >>> >>> Anthony >>> >>> On Tuesday, May 3, 2016 at 11:22:07 AM UTC-4, Krzysztof Socha wrote: >>>> >>>> I have issues with showing "flash"-type messages recently. First I >>>> could not get them to show at all. I updated several files in my >>>> application based on the recent version of web2py (R-2.14.5), such as >>>> web2py.js, web2py-ajax.html, and the like. >>>> >>>> Now it shows the flash message, but the formatting is all wrong. It >>>> just shows it on top of the page. Some digging revealed that the flash >>>> messages are put in a DIV with class="flash", while web2py.js is expecting >>>> class="w2p_flash". Anyone has an idea why it is like that and what to do to >>>> fix it? >>>> >>>> Krzysztof. >>>> >>> -- > 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/QaCC_IaBZ5A/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/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: Flash messages not showing correctly
Worked! Thanks! BTW: I keep running into issues when updating old web2py applications to new releases of web2py... Is there a recommended way of doing it? It is not very clear which files in my application folder should be changed/replaced/updated/edited when updating web2py. Krzysztof. On Tuesday, May 3, 2016 at 5:31:52 PM UTC+2, Anthony wrote: > > In layout.html, have you tried changing the class of the flash div from > "flash" to "w2p_flash"? > > Anthony > > On Tuesday, May 3, 2016 at 11:22:07 AM UTC-4, Krzysztof Socha wrote: >> >> I have issues with showing "flash"-type messages recently. First I could >> not get them to show at all. I updated several files in my application >> based on the recent version of web2py (R-2.14.5), such as web2py.js, >> web2py-ajax.html, and the like. >> >> Now it shows the flash message, but the formatting is all wrong. It just >> shows it on top of the page. Some digging revealed that the flash messages >> are put in a DIV with class="flash", while web2py.js is expecting >> class="w2p_flash". Anyone has an idea why it is like that and what to do to >> fix it? >> >> Krzysztof. >> > -- 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] Flash messages not showing correctly
I have issues with showing "flash"-type messages recently. First I could not get them to show at all. I updated several files in my application based on the recent version of web2py (R-2.14.5), such as web2py.js, web2py-ajax.html, and the like. Now it shows the flash message, but the formatting is all wrong. It just shows it on top of the page. Some digging revealed that the flash messages are put in a DIV with class="flash", while web2py.js is expecting class="w2p_flash". Anyone has an idea why it is like that and what to do to fix it? Krzysztof. -- 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: How to disable cache on client side, but keep it on server side?
Thanks! I somehow was under the impression that the old way of using cache is somehow deprecated. I re-read the book again, and there is just a statement "We recommend @cache.action <http://web2py.com/books/default/chapter/29/04/the-core?search=cache#markmin_cache_action> starting from web2py > 2.4.6". But since this is not possible with cache.action, I will try using the cache.ram. Cheers, Krzysztof. On Monday, February 29, 2016 at 1:36:45 AM UTC+1, Anthony wrote: > > Looking at the code, it does not appear it is possible to turn off client > side caching when using @cache.action. However, if you don't want > client-side caching, you might as well just use @cache.ram. > > Anthony > > On Sunday, February 28, 2016 at 3:39:08 PM UTC-5, Krzysztof Socha wrote: >> >> I have a page that is sometimes (not very often) updated. The default >> view is quite complex, so caching it in RAM significantly improves >> performance. However, if I try to cache it in RAM using something like: >> >> @cache.action(time_expire=3600, cache_model=cache.ram, prefix='index') >> >> the browser serves the locally cached version even if the content changes >> and I clear the cache by: >> >> cache.ram.clear('index*') >> >> Is there a way to disable browser cache, but keep server cache? The book >> says that cache.action: "will do one or another or *both*" So how do I >> just do the server-side caching without client-side? >> >> This is probably something obvious, but I cannot figure it out for a >> while now... any hints greatly appreciated. >> >> Cheers, >> Krzysztof. >> > -- 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] How to disable cache on client side, but keep it on server side?
I have a page that is sometimes (not very often) updated. The default view is quite complex, so caching it in RAM significantly improves performance. However, if I try to cache it in RAM using something like: @cache.action(time_expire=3600, cache_model=cache.ram, prefix='index') the browser serves the locally cached version even if the content changes and I clear the cache by: cache.ram.clear('index*') Is there a way to disable browser cache, but keep server cache? The book says that cache.action: "will do one or another or *both*" So how do I just do the server-side caching without client-side? This is probably something obvious, but I cannot figure it out for a while now... any hints greatly appreciated. Cheers, Krzysztof. -- 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: GRID selectable inside component
On Wednesday, January 6, 2016 at 5:30:25 PM UTC+1, Anthony wrote: > > >> I guess, this is more-less what I need to do, but this is not perfect, as >> I have several applications that I maintain and updating all of them >> manually is not great. Also - is this the only file that should be updated >> in this way? I am not sure... What about web2py_ajax.html? appadmin.html? >> Others? >> > > The issue isn't simply whether there have been changes in the file but > whether there have been changes in the file that are directly linked to > changes in the core framework. web2py.js includes code that depends on > particular HTML classes and data-* attributes generated by web2py HTML > helpers and widgets, so sometimes changes in the core framework are coupled > with changes in web2py.js and the two must therefore be upgraded in tandem. > This is less likely to be the case with other app-specific files. For > example, you can upgrade appadmin.py and appadmin.html, but the old > versions should generally continue to work with new versions of the > framework. It's probably worth upgrading web2py_ajax.html as well. > This just reinforces my point... Perhaps these files (and any others?) should be managed as part of the framework, and not as part of an application. > > >> >> >>> This is a good point, though -- perhaps we should come up with a way to >>> ensure web2py.js is easily upgraded along with the rest of the framework. >>> For now, though, you could always link to the version of web2py.js that >>> comes with the "welcome" app, as that will always be upgraded with the >>> framework. >>> >>> >> I will try the linking, but not sure how this will work with git >> throughout different filesystems and OSes... (I use Linux on some >> development systems and BSD on some production servers)... git should >> preserve the link, but... >> > > I didn't mean you should create symbolic links to the web2py.js file in > the welcome app -- I meant actually serve that file via its usual URL. So, > in web2py_ajax.html, instead of using URL('static', 'js/web2py.js'), change > it to URL('welcome', 'static', 'js/web2py.js'). > > Ok. I see. However, in a production environment I do not exactly want to have the welcome app enabled... Which means that this kind of link should actually NOT work... Krzysztof. -- 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: GRID selectable inside component
On Wednesday, January 6, 2016 at 1:58:19 PM UTC+1, Anthony wrote: > > > Well, any time you upgrade the framework, you should always upgrade > web2py.js (no need to check whether it has changed -- just do it). > > I guess, this is more-less what I need to do, but this is not perfect, as I have several applications that I maintain and updating all of them manually is not great. Also - is this the only file that should be updated in this way? I am not sure... What about web2py_ajax.html? appadmin.html? Others? > This is a good point, though -- perhaps we should come up with a way to > ensure web2py.js is easily upgraded along with the rest of the framework. > For now, though, you could always link to the version of web2py.js that > comes with the "welcome" app, as that will always be upgraded with the > framework. > > I will try the linking, but not sure how this will work with git throughout different filesystems and OSes... (I use Linux on some development systems and BSD on some production servers)... git should preserve the link, but... Anyway - thanks for your help - it allowed me to pinpoint and fix the problem for now. Krzysztof. -- 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] web2py version reported in the admin interface does not match the git tag?
I have been playing with git repo for web2py, and I find it very useful. Especially the tags - you can easily move from the current master (trunk) to a specific stable release... or so it seems. I noticed that the tag do not seem to match the version numbers reported in the admin panel for some reason... Some examples: R-2.13.4 -> 2.13.3-stable+timestamp.2015.12.24.08.08.22 R-2.13.3 -> 2.13.3-stable+timestamp.2015.12.24.08.08.22 R-2.13.2 -> 2.12.3-stable+timestamp.2015.08.18.19.14.07 R-2.13.1 -> 2.12.3-stable+timestamp.2015.08.18.19.14.07 R-2.12.3 -> 2.12.3-stable+timestamp.2015.08.18.19.14.07 It seems that the version information is not always updated when a new tag is created... Maybe this could be automated somehow, because as it is it always makes me wonder, if I checked out the right tag... Krzysztof. -- 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: GRID selectable inside component
Ok. I think I got it... I started developing my application long time ago based on a welcome app. I have updated web2py regularly, but I have not updated original welcome application files that are specific to web2py, such as web2py.js It appears that there have been changes there as well, but they are not handled properly by the update procedure... Once I replaced the web2py.js for my application with a newer version, it works now fine. Perhaps these dependencies should be re-thought? Maybe they should be moved out of application tree into somewhere else? Framework-wide js folder, or something... It is not clear how to make sure they are up to date without manually checking after every web2py update... Anyway - thank you for your support! Cheers, Krzysztof. On Friday, January 1, 2016 at 12:27:22 AM UTC+1, Anthony wrote: > > Oops, got it. Still can't reproduce. > > On Thursday, December 31, 2015 at 5:23:38 PM UTC-5, Krzysztof Socha wrote: >> >> As I wrote: >> >> 2.13.4-stable+timestamp.2015.12.26.04.59.39 >> (Running on nginx/1.4.6, Python 2.7.6) >> >> Strange... I will have to investigate a bit more, than. I will report >> back, what I find. >> >> Krzysztof. >> >> On Thursday, December 31, 2015 at 10:38:10 PM UTC+1, Anthony wrote: >>> >>> Sorry, tried your exact code and it works for me. Which version of >>> web2py? Maybe attach a minimal app that demonstrates the problem. >>> >>> Anthony >>> >>> On Thursday, December 31, 2015 at 3:39:37 PM UTC-5, Krzysztof Socha >>> wrote: >>>> >>>> Anthony, >>>> >>>> Thank you for (very) quick reaction! And Happy New Year! ;) >>>> >>>> Here is an example: >>>> >>>> I define a grid in the following action: >>>> def grid_test(): >>>> grid = SQLFORM.grid(db.project, formname='grid_test',selectable=[('Test', >>>> lambda ids: 1/0)]) >>>> response.view = 'project/grid.load' >>>> return dict(grid=grid) >>>> >>>> ...of course the expected behavior is that the 'Test' action will cause >>>> an error (division by zero). Indeed, this happens if I simply put such >>>> defined grid as part of regular controller action. >>>> >>>> However, when I put it in a component: >>>> >>>> {{=LOAD('project','grid_test.load', ajax=True)}} >>>> >>>> where the grid.load looks like this: >>>> >>>> {{=grid}} >>>> >>>> Pressing the 'Test' button does not cause the error - presumably >>>> because the selectable action is not executed at all... >>>> >>>> I hope this is clear enough. In my code, I actually tried to do a >>>> redirect, but the result is exactly the same - the selectable action does >>>> not appear to execute... I just tested this on: >>>> >>>> 2.13.4-stable+timestamp.2015.12.26.04.59.39 >>>> (Running on nginx/1.4.6, Python 2.7.6) >>>> >>>> Krzysztof. >>>> >>>> On Thursday, December 31, 2015 at 8:41:46 PM UTC+1, Anthony wrote: >>>>> >>>>> A basic example works for me. Can you show some code that you know >>>>> exhibits the problem? >>>>> >>>>> Anthony >>>>> >>>>> On Thursday, December 31, 2015 at 12:53:53 PM UTC-5, Krzysztof Socha >>>>> wrote: >>>>>> >>>>>> I noticed a similar thing... I need two grids on a page. As >>>>>> documented, it does not work very well to simply put them in one >>>>>> controller >>>>>> function. Hence, I tried with LOADing a component. This generally works, >>>>>> but I cannot get the selectable actions to work. I have defined custom >>>>>> selectable actions and they work fine if the gird is not inside a >>>>>> component. As soon, as I load it as a component, nothing happens. It >>>>>> seems >>>>>> that the form is submitted, but the selectable action is not executed. A >>>>>> bug somewhere? Or is there another way of doing this? >>>>>> >>>>>> Krzysztof. >>>>>> >>>>>> On Wednesday, October 15, 2014 at 7:46:56 PM UTC+2, LaDarrius Stewart >>>>>> wrote: >>>>>>> >>>>>>> I have a grid inside a component i
[web2py] Re: GRID selectable inside component
As I wrote: 2.13.4-stable+timestamp.2015.12.26.04.59.39 (Running on nginx/1.4.6, Python 2.7.6) Strange... I will have to investigate a bit more, than. I will report back, what I find. Krzysztof. On Thursday, December 31, 2015 at 10:38:10 PM UTC+1, Anthony wrote: > > Sorry, tried your exact code and it works for me. Which version of web2py? > Maybe attach a minimal app that demonstrates the problem. > > Anthony > > On Thursday, December 31, 2015 at 3:39:37 PM UTC-5, Krzysztof Socha wrote: >> >> Anthony, >> >> Thank you for (very) quick reaction! And Happy New Year! ;) >> >> Here is an example: >> >> I define a grid in the following action: >> def grid_test(): >> grid = SQLFORM.grid(db.project, formname='grid_test',selectable=[('Test', >> lambda ids: 1/0)]) >> response.view = 'project/grid.load' >> return dict(grid=grid) >> >> ...of course the expected behavior is that the 'Test' action will cause >> an error (division by zero). Indeed, this happens if I simply put such >> defined grid as part of regular controller action. >> >> However, when I put it in a component: >> >> {{=LOAD('project','grid_test.load', ajax=True)}} >> >> where the grid.load looks like this: >> >> {{=grid}} >> >> Pressing the 'Test' button does not cause the error - presumably because >> the selectable action is not executed at all... >> >> I hope this is clear enough. In my code, I actually tried to do a >> redirect, but the result is exactly the same - the selectable action does >> not appear to execute... I just tested this on: >> >> 2.13.4-stable+timestamp.2015.12.26.04.59.39 >> (Running on nginx/1.4.6, Python 2.7.6) >> >> Krzysztof. >> >> On Thursday, December 31, 2015 at 8:41:46 PM UTC+1, Anthony wrote: >>> >>> A basic example works for me. Can you show some code that you know >>> exhibits the problem? >>> >>> Anthony >>> >>> On Thursday, December 31, 2015 at 12:53:53 PM UTC-5, Krzysztof Socha >>> wrote: >>>> >>>> I noticed a similar thing... I need two grids on a page. As documented, >>>> it does not work very well to simply put them in one controller function. >>>> Hence, I tried with LOADing a component. This generally works, but I >>>> cannot >>>> get the selectable actions to work. I have defined custom selectable >>>> actions and they work fine if the gird is not inside a component. As soon, >>>> as I load it as a component, nothing happens. It seems that the form is >>>> submitted, but the selectable action is not executed. A bug somewhere? Or >>>> is there another way of doing this? >>>> >>>> Krzysztof. >>>> >>>> On Wednesday, October 15, 2014 at 7:46:56 PM UTC+2, LaDarrius Stewart >>>> wrote: >>>>> >>>>> I have a grid inside a component inside a component which has >>>>> selectable set to run a function that assigns the ids to a session >>>>> variable. When inside the component it does not work when i click submit >>>>> I >>>>> can tell that the page is being reloaded but the callback does not run. I >>>>> know that the code works because if I go to the .load page directly and >>>>> try >>>>> it works as expected. But from the component page it doesnt execute the >>>>> callback. >>>>> >>>>> >>>>> >>>>> selectable = [('Create Invoice', lambda ids: [selectabletest(ids)], >>>>> 'btn btn-info btn-md')] >>>>> grid2 = SQLFORM.grid(query, selectable=selectable, >>>>> args=request.args[:1], formname='invgrid', user_signature=False) >>>>> >>>>> def selectabletest(ids): >>>>> session.lambdatest = ids >>>>> >>>>> This message is for named person(s) only. It may contain confidential >>>>> and/or legally privileged information. No confidentiality or privilege >>>>> is >>>>> waived or lost should mis-transmission occur. If you receive this >>>>> message >>>>> in error, delete it (and all copies) and notify the sender. You must >>>>> not, >>>>> directly or indirectly,use, disclose, distribute, print, or copy any part >>>>> of this message if you are not the intended recipient. GAD GROUP >>>>> TECHNOLOGY, INC. reserves the right to monitor all e-mail communications >>>>> through its networks. >>>>> >>>>> Any views expressed in this message are those of the individual >>>>> sender, except where the message states otherwise and the sender is >>>>> authorized to state them to be the views of any such entity. >>>>> >>>>> This e-mail has been virus and content scanned by GAD GROUP >>>>> TECHNOLOGY, INC. >>>>> >>>> -- 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: GRID selectable inside component
Anthony, Thank you for (very) quick reaction! And Happy New Year! ;) Here is an example: I define a grid in the following action: def grid_test(): grid = SQLFORM.grid(db.project, formname='grid_test',selectable=[('Test', lambda ids: 1/0)]) response.view = 'project/grid.load' return dict(grid=grid) ...of course the expected behavior is that the 'Test' action will cause an error (division by zero). Indeed, this happens if I simply put such defined grid as part of regular controller action. However, when I put it in a component: {{=LOAD('project','grid_test.load', ajax=True)}} where the grid_test.load looks like this: {{=grid}} Pressing the 'Test' button does not cause the error - presumably because the selectable action is not executed at all... I hope this is clear enough. In my code, I actually tried to do a redirect, but the result is exactly the same - the selectable action does not appear to execute... I just tested this on: 2.13.4-stable+timestamp.2015.12.26.04.59.39 (Running on nginx/1.4.6, Python 2.7.6) Krzysztof. On Thursday, December 31, 2015 at 8:41:46 PM UTC+1, Anthony wrote: > > A basic example works for me. Can you show some code that you know > exhibits the problem? > > Anthony > > On Thursday, December 31, 2015 at 12:53:53 PM UTC-5, Krzysztof Socha wrote: >> >> I noticed a similar thing... I need two grids on a page. As documented, >> it does not work very well to simply put them in one controller function. >> Hence, I tried with LOADing a component. This generally works, but I cannot >> get the selectable actions to work. I have defined custom selectable >> actions and they work fine if the gird is not inside a component. As soon, >> as I load it as a component, nothing happens. It seems that the form is >> submitted, but the selectable action is not executed. A bug somewhere? Or >> is there another way of doing this? >> >> Krzysztof. >> >> On Wednesday, October 15, 2014 at 7:46:56 PM UTC+2, LaDarrius Stewart >> wrote: >>> >>> I have a grid inside a component inside a component which has selectable >>> set to run a function that assigns the ids to a session variable. When >>> inside the component it does not work when i click submit I can tell that >>> the page is being reloaded but the callback does not run. I know that the >>> code works because if I go to the .load page directly and try it works as >>> expected. But from the component page it doesnt execute the callback. >>> >>> >>> >>> selectable = [('Create Invoice', lambda ids: [selectabletest(ids)], 'btn >>> btn-info btn-md')] >>> grid2 = SQLFORM.grid(query, selectable=selectable, >>> args=request.args[:1], formname='invgrid', user_signature=False) >>> >>> def selectabletest(ids): >>> session.lambdatest = ids >>> >>> This message is for named person(s) only. It may contain confidential >>> and/or legally privileged information. No confidentiality or privilege is >>> waived or lost should mis-transmission occur. If you receive this message >>> in error, delete it (and all copies) and notify the sender. You must not, >>> directly or indirectly,use, disclose, distribute, print, or copy any part >>> of this message if you are not the intended recipient. GAD GROUP >>> TECHNOLOGY, INC. reserves the right to monitor all e-mail communications >>> through its networks. >>> >>> Any views expressed in this message are those of the individual sender, >>> except where the message states otherwise and the sender is authorized to >>> state them to be the views of any such entity. >>> >>> This e-mail has been virus and content scanned by GAD GROUP TECHNOLOGY, >>> INC. >>> >> -- 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: GRID selectable inside component
I noticed a similar thing... I need two grids on a page. As documented, it does not work very well to simply put them in one controller function. Hence, I tried with LOADing a component. This generally works, but I cannot get the selectable actions to work. I have defined custom selectable actions and they work fine if the gird is not inside a component. As soon, as I load it as a component, nothing happens. It seems that the form is submitted, but the selectable action is not executed. A bug somewhere? Or is there another way of doing this? Krzysztof. On Wednesday, October 15, 2014 at 7:46:56 PM UTC+2, LaDarrius Stewart wrote: > > I have a grid inside a component inside a component which has selectable > set to run a function that assigns the ids to a session variable. When > inside the component it does not work when i click submit I can tell that > the page is being reloaded but the callback does not run. I know that the > code works because if I go to the .load page directly and try it works as > expected. But from the component page it doesnt execute the callback. > > > > selectable = [('Create Invoice', lambda ids: [selectabletest(ids)], 'btn > btn-info btn-md')] > grid2 = SQLFORM.grid(query, selectable=selectable, args=request.args[:1], > formname='invgrid', user_signature=False) > > def selectabletest(ids): > session.lambdatest = ids > > This message is for named person(s) only. It may contain confidential > and/or legally privileged information. No confidentiality or privilege is > waived or lost should mis-transmission occur. If you receive this message > in error, delete it (and all copies) and notify the sender. You must not, > directly or indirectly,use, disclose, distribute, print, or copy any part > of this message if you are not the intended recipient. GAD GROUP > TECHNOLOGY, INC. reserves the right to monitor all e-mail communications > through its networks. > > Any views expressed in this message are those of the individual sender, > except where the message states otherwise and the sender is authorized to > state them to be the views of any such entity. > > This e-mail has been virus and content scanned by GAD GROUP TECHNOLOGY, > INC. > -- 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: Problem with processing unicode character by render function in gluon.template
It appears that I have been missing somthing. It is sufficient to properly encode the string before passing it to render: render(template_content.encode('utf-8')) -- 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] Problem with processing unicode character by render function in gluon.template
I tried to use the templating system of web2py for parsing dynamically generated views. Theoretically, it should work - render from gluon.template accepts streams and strings as well. However, it seems that due to the fact it uses cStringIO instead of StringIO, it is unable to process unicode characters: http://stackoverflow.com/questions/4677512/can-i-use-cstringio-the-same-as-stringio So if my dynamically generated view contains any unicode characters, the rendering breaks with the error: 'ascii' codec can't encode character It seems that it would be sufficient to change cStringIO to StringIO in gluon.template Or am I missing 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/d/optout.
[web2py] Re: cache.action decorator generates an error
Just a little add-on: it seems now to work fine, if *time_expire>0*. It only fails for *time_expire=0*. So I guess it is an improvement :) When will this be fixed in a stable release? Or should I use the github version for my production server? Cheers, Krzysztof. On Saturday, October 17, 2015 at 5:56:20 PM UTC+2, Krzysztof Socha wrote: > > I cloned repo from github, and now I get: > > type 'exceptions.UnboundLocalError'> local variable 'expires' referenced > before assignment > > I guess something was fixed, but something else got broken? More details: > > File "/opt/web2py/gluon/cache.py", line 680, in wrapped_f > 'Expires' : expires, > UnboundLocalError: local variable 'expires' referenced before assignment > > > Regards, > Krzysztof. > > On Saturday, October 17, 2015 at 4:39:44 AM UTC+2, Massimo Di Pierro wrote: >> >> This may be fixed in trunk. Can you please check it. >> >> On Wednesday, 14 October 2015 13:03:01 UTC-5, Krzysztof Socha wrote: >>> >>> Hi, >>> >>> I am trying to configure caching on my site, but it does not seem to >>> work. As soon as I use the cache.action decorator, such as: >>> >>> @cache.action(time_expire=0,cache_model=cache.ram) >>> >>> for any action in the controller, I get an exception thrown with: >>> >>> *'session_' local variable referenced before assignment* >>> >>> It works with *cache_model=None*, but this is not exactly what I >>> want >>> >>> web2py version: >>> >>> 2.12.3-stable+timestamp.2015.08.19.00.18.03 >>> (Running on nginx/1.4.6, Python 2.7.6) >>> >>> Any thoughts on this? >>> >>> Regards, >>> Krzysztof. >>> >> -- 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: cache.action decorator generates an error
I cloned repo from github, and now I get: type 'exceptions.UnboundLocalError'> local variable 'expires' referenced before assignment I guess something was fixed, but something else got broken? More details: File "/opt/web2py/gluon/cache.py", line 680, in wrapped_f 'Expires' : expires, UnboundLocalError: local variable 'expires' referenced before assignment Regards, Krzysztof. On Saturday, October 17, 2015 at 4:39:44 AM UTC+2, Massimo Di Pierro wrote: > > This may be fixed in trunk. Can you please check it. > > On Wednesday, 14 October 2015 13:03:01 UTC-5, Krzysztof Socha wrote: >> >> Hi, >> >> I am trying to configure caching on my site, but it does not seem to >> work. As soon as I use the cache.action decorator, such as: >> >> @cache.action(time_expire=0,cache_model=cache.ram) >> >> for any action in the controller, I get an exception thrown with: >> >> *'session_' local variable referenced before assignment* >> >> It works with *cache_model=None*, but this is not exactly what I >> want >> >> web2py version: >> >> 2.12.3-stable+timestamp.2015.08.19.00.18.03 >> (Running on nginx/1.4.6, Python 2.7.6) >> >> Any thoughts on this? >> >> Regards, >> Krzysztof. >> > -- 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] cache.action decorator generates an error
Hi, I am trying to configure caching on my site, but it does not seem to work. As soon as I use the cache.action decorator, such as: @cache.action(time_expire=0,cache_model=cache.ram) for any action in the controller, I get an exception thrown with: *'session_' local variable referenced before assignment* It works with *cache_model=None*, but this is not exactly what I want web2py version: 2.12.3-stable+timestamp.2015.08.19.00.18.03 (Running on nginx/1.4.6, Python 2.7.6) Any thoughts on this? Regards, Krzysztof. -- 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] Custom login form error display
> > > Note, if you use form.custom.widget.fieldname in a custom form, you still > get errors displayed automatically (the error is part of the widget > object). The example linked above shows the hiderror option being used. In > that case, you are explicitly suppressing the automatic error display (this > affects standard forms as well as custom forms). In the example shown, > instead of showing errors within the form itself (the default automatic > behavior), the errors are manually inserted all together at the top of the > form. > > I have a similar problem, but a bit more complicated... I have a SQLFORM (form) and a SQLFORM.grid (grid) in one view. The grid can be edited, and one of the fields uses a custom widget. I have no clue how to get to the errors of that field to show them properly. If I use the form.errors, I get only the errors for the 'form'. How do I get the errors for the 'grid'? I tried grid.errors, but only get an error saying that DIV element has no attribute 'errors'... Any thoughts? Krzysztof. -- 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: Prevent multiple submit buttons from showing "Working..." on submit
On Wednesday, December 11, 2013 at 10:01:39 PM UTC+1, Mark Li wrote: > > I looked into the code and my web2py.js was not the same as the github > link, which I noticed because my forminputclickselector did not contain > > :not([name]) > > . When I diff-ed the original link for the newest web2py.js, with my > current web2py.js, it showed no difference. Very odd, maybe I had an old > web2py.js in browser cache. Sorry for the confusion. > > >> I have the same problem now -all of my (non-submit!) buttons got 'Working...' message when submitting the form. I checked the github link again... The lines do not match anymore, but I have not found not([name]) anywhere now... How do I disable this behaviour? Krzysztof. -- 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] Adding scheduler to an existing app break the MySQL DB...
I am fighting it for some time now... I tried all the different ways to migrate the database so that the tables for the scheduler are created, but no luck - maybe someone could help... I have an existing application. Recently I decided I needed to run some things in the background, so I added a scheduler.py model with content like this: def send_mail(jar_id): logger.info('Mail notifications have been sent.') from gluon.scheduler import Scheduler scheduler = Scheduler(db) where db is defined like this in db.py model: db = DAL('mysql://xxx:xxx@localhost/xxx',pool_size=1,check_reserved=['all'], migrate=True,fake_migrate=False) As soon, as I try to schedule a task, this result in an error: gluon.contrib.pymysql.err.ProgrammingError: (1146, u"Table 'xxx.scheduler_task' doesn't exist") I tried setting the fake_migrate to True, removing files in xxx/databases, etc. No luck. Any hint, how to make it work? Krzysztof. -- 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] Nginx/passenger/web2py -> 504 Gateway Timeout?
Yes - this is what I did. And yes - it seams to be a configuration issue... It is just that I have no clue where to look :( On Wednesday, April 16, 2014 12:59:36 PM UTC+2, LightDot wrote: > > So, I would say this is a configuration issue... But I'm not sure what's > the problem. @Krzysztof, when you say you've put all web2py files within > the folder, expected by passenger, did you omit the top web2py directory? > The structure should be simply: > > top_passenger_dir/ > applications > deposit > gluon > ...etc... > passenger_wsgi.py > web2py.py > > Regards > > On Tuesday, April 15, 2014 6:17:17 PM UTC+2, Richard wrote: >> >> I make it works with Phusion long time ago, and then get convinced after >> reading a blog post that this were a bad idea, since at that time phusion >> was not following the same rule as other linux in matter of service >> managment, so I resign. I remember having read and work hard, since there >> were no single one-stop place to make it works... The phusion doc, was the >> better place + blog post and tuto. >> >> Sorry I couldn't help more... But I would again suggest you to walkaway >> of phusion if you can somehow. My understanding is this project is not >> enough or wasn't (1,5 years ago) to work in production. I was required to >> compile Nginx to include phusion module because it is not include by >> default, to me just that is enough to not consider it prod ready... >> >> Richard >> >> >> On Tue, Apr 15, 2014 at 3:34 AM, Krzysztof Socha wrote: >> >>> Thanks... But I kinda cannot... The hosting I am using is providing >>> nginx + phusion passenger... and it works with a simple script, as I have >>> shown. Unfortunately, it looks like the web2py handler never returns >>> anything and the request time-outs... I do not even know where to look to >>> understand what happens... Any suggestions? >>> >>> Krzysztof. >>> >>> >>> On Monday, April 14, 2014 3:58:16 PM UTC+2, Richard wrote: >>>> >>>> Use unicorn!! >>>> >>>> Phusion is more work... >>>> >>>> You can have a look in contrib there is a scrip that help deploy >>>> redmine beside web2py with unicorn, so you can derive something for you >>>> need from it. It works with 12.04. >>>> >>>> Richard >>>> >>>> >>>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+un...@googlegroups.com. >>> For more options, visit https://groups.google.com/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.
Re: [web2py] Nginx/passenger/web2py -> 504 Gateway Timeout?
Thanks... But I kinda cannot... The hosting I am using is providing nginx + phusion passenger... and it works with a simple script, as I have shown. Unfortunately, it looks like the web2py handler never returns anything and the request time-outs... I do not even know where to look to understand what happens... Any suggestions? Krzysztof. On Monday, April 14, 2014 3:58:16 PM UTC+2, Richard wrote: > > Use unicorn!! > > Phusion is more work... > > You can have a look in contrib there is a scrip that help deploy redmine > beside web2py with unicorn, so you can derive something for you need from > it. It works with 12.04. > > Richard > > > -- 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] Nginx/passenger/web2py -> 504 Gateway Timeout?
I am trying to setup (vanila) web2py on shared hosting with nginx and passenger with support for python. I put all the files from web2py folder in the folder expected by passenger, I created a file passenger_wsgi.py required by passenger, which I simlinked to wsgihandler.py (taken from the handlers dir to the dir where web2py.py resides). The result: nothing works - I get consistently 504 Gateway Timeout for every attempted connection. On the other hand, when I simply created a passenger_wsgi.py file that contained: def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) return [b"hello world!\n"] then everything works fine - i.e., I get the "hello world". I believe, it takes about one minute for the request to time-out... Does the web2py startup take so long? When can/should I do to make it work? Krzysztof. start_response('200 OK', [('Content-Type', 'text/plain')]) return [b"hello world!\n"] def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) return [b"hello world!\n"] def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) return [b"hello world!\n"] def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) return [b"hello world!\n"] -- 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: Beginner question: foreign key constraint failed (?)
Just an update. It appears to be an issue with SQLITE. The actual problem was related to the fact that I have redefined AUTH_USER table (by company table - not all of it quated in my post). I had a missing field used in the default NavBar - first_name. When I switched from SQLITE to MYSQL, the error message was more informative - somthing about missing attribute 'first_name'. This led in turn to discovering that in fact the 'first_name' is kind of required field when redefining the AUTH_USER table, even though the documentation does not say so Hope it will help others. BTW: The error message from SQLITE could be improved... -- 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: Beginner question: foreign key constraint failed (?)
On Thursday, March 27, 2014 5:21:34 PM UTC+1, Niphlod wrote: > > did you try with a fresh database ? > > After some investigation, it seems that the problem is not related to what I wrote above (!) I tried to change the DB - to MySQL - and the error reported changed to something like 'attribute "first_name" not found'. From this I managed to understand what happens. In fact, the 'company' table is redefining auth_user table. However, it seems that (contrary to the documentation) the 'first_name' field is needed by the default implementation of the NavBar. And hence the error. It is weird that SQLite reports it as foreign constraint failed... Or maybe indeed there was something wrong with the SQLite database in the first place... Anyway... The conclusion is - the code I gave above actually works. -- 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] Beginner question: foreign key constraint failed (?)
I created a simple table that uses another table as a list of possible values for a field: db.define_table('country', Field('name','string',length=DEFAULT_STRING_LENGTH)) db.define_table('company', Field('name', 'string', requires=IS_NOT_EMPTY(error_message=auth.messages.is_empty)), Field('address', 'string', Field('country','reference country', requires=IS_IN_DB(db,db.country.id))) This is all very simplistic, and I just want to have the ID in the dropdown (later to be replaced by something like 'represent=db.country.name(db.country.id))', but it does not work as it is... The form shows up, I need to put something in the NAME field and choose something for the COUNTRY field - otherwise the validators complain - but aftwerwords I systematically get: foreign key constraint failed -- 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.