[web2py] Re: Accessing the 404 error message in a custom page

2020-04-19 Thread 'Yan Wong' via web2py-users
Sorry, I meant a page for HTTP 400 errors, not 404 errors, e.g. when I call raise HTTP(404, 'bad values'), but the principle is the same. On Sunday, 19 April 2020 22:28:12 UTC+1, Yan Wong wrote: > > I want to have a custom styled page for my 404 errors, so that when I do > raise(404, 'bad

[web2py] Accessing the 404 error message in a custom page

2020-04-19 Thread 'Yan Wong' via web2py-users
I want to have a custom styled page for my 404 errors, so that when I do raise(404, 'bad values') it returns a nicely styled page. I have placed the following line in my routes.py routes_onerror = [('myapp/404', '/myapp/default/custom_404.html')] but I don't know how to access the error

[web2py] Re: Open form action in new window/tab only when validation passed

2020-04-18 Thread 'Yan Wong' via web2py-users
I think I've worked out what I *want* to do, but I'm not sure if this is easy in web2py. I want to use the onsubmit handler in a form to reload the form from a .load view, but return false so that the *final* submit action is not called. Then, if the reloaded form validates, I can set

[web2py] Open form action in new window/tab only when validation passed

2020-04-17 Thread 'Yan Wong' via web2py-users
I have page containing a web2py form, and the page is meant to be viewed in an iframe. However, if the form validates, I need to escape the iframe by opening the action URL in a new tab, e.g. using target="_blank" (this is a redirect to a PayPal payments page, which is why it will not work in

[web2py] Standard way of removing X-Powered-By: web2py http header?

2020-04-12 Thread 'Yan Wong' via web2py-users
I'm a bit disappointed that web2py by default sets `X-Powered-By: web2py` in the http header, thus making it easier for web-scanning tools to detect the software running behind a web site, and allow more targetted attacks. Is there an easy config option to efficiently turn this off for all

[web2py] Web2py with python3: difference in error reporting

2019-02-04 Thread 'Yan Wong' via web2py-users
I'm contemplating switching my web2py site to python3. However, when I do so, the error messages logged to applications/myapp/errors, to which I'm directed if I have made a web2py python coding error, seem a lot less useful, for instance they don't seem to give sensible line numbers into my

[web2py] How can I disable the "working..." button text?

2018-03-08 Thread 'Yan Wong' via web2py-users
I'm using submit buttons on forms to submit post requests to new windows, using . The problem is, web2py automatically changes the button text to "Working..." on the original page, after the submit button is clicked. There are some specific buttons where I don't want this to happen. How can I

[web2py] Correct mySQL warning about NO_AUTO_CREATE_USER

2018-03-05 Thread 'Yan Wong' via web2py-users
A while ago I mentioned that running web2py with mySQL 5.7.7+ / pymysql gives the following warning: /usr/local/lib/python2.7/site-packages/pymysql/cursors.py:165: Warning: (3090, u"Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.") I have tracked

[web2py] Re: Option to load modified appconfig in rocket server

2018-03-02 Thread 'Yan Wong' via web2py-users
Anthony: I'm assuming that on my production server, which is run through uwsgi, the 'args' argument is typically not used, so this won't interfere with anything? I can't find much documentation about request.env.cmd_options.args. Cheers Yan On Thursday, 1 March 2018 12:23:44 UTC, Anthony

[web2py] Re: Option to load modified appconfig in rocket server

2018-03-01 Thread 'Yan Wong' via web2py-users
Great, thanks both. On Thursday, 1 March 2018 12:23:44 UTC, Anthony wrote: > > On Thursday, March 1, 2018 at 7:02:53 AM UTC-5, Leonel Câmara wrote: >> >> An easy way would be to simply check for the port where the request was >> made and simply run rocket on a different port for testing e.g.

[web2py] Re: Option to load modified appconfig in rocket server

2018-03-01 Thread 'Yan Wong' via web2py-users
Thanks. I really need to modify this programmatically for a functional test suite - it's not so much a dev vs prod thing. If I have a modified appconfig, how do I set web2py to use it for a particular rocket instance, but not normally? On Thursday, 1 March 2018 11:33:15 UTC, 黄祥 wrote: > > i

[web2py] Option to load modified appconfig in rocket server

2018-03-01 Thread 'Yan Wong' via web2py-users
For testing purposes, I would like to set up some functional tests that check that web2py scripts work properly with different parameters set in appconfig.ini. Is there any way to fire up rocketsever and point it to a modified appconfig.ini file? -- Resources: - http://web2py.com -

[web2py] Using args with default function in controller

2018-01-25 Thread 'Yan Wong' via web2py-users
I have a non-default controller with a default function, index(), which uses the index.html view, and which accepts arguments that begin with an @ sign. When I go to www.mysite.org/controller/index/@arg1 it rightly fires off the index() function with args = ["@arg1"]. And when I go to

[web2py] Force load an injected LOAD(ajax=True) helper

2017-09-28 Thread 'Yan Wong' via web2py-users
I have a LOAD() helper in a view, but that view itself gets loaded into my main page using the jQuery load() function, after a user interaction. That means the standard web2py events aren't attached to the LOAD() helper, and it is just permanently displayed as "loading...". Is there some

Re: [web2py] Re: Support for BIT(1) as boolean?

2017-09-15 Thread 'Yan Wong' via web2py-users
The following seems to work, by the way (modified from https://groups.google.com/forum/#!topic/web2py/TZsLnytjqhA) ## allow mysql tinyint from gluon.dal import SQLCustomType boolean = SQLCustomType( type ='boolean', native='TINYINT(1)',

Re: [web2py] Re: Support for BIT(1) as boolean?

2017-09-15 Thread 'Yan Wong' via web2py-users
On Monday, 11 September 2017 00:08:00 UTC+1, Massimo Di Pierro wrote: > > what adapter are you using. What is your URI string (without passwords > please)? > By the way, starting web2py using Rocket now says /usr/local/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (3090,

Re: [web2py] Re: Support for BIT(1) as boolean?

2017-09-14 Thread 'Yan Wong' via web2py-users
On Monday, 11 September 2017 00:08:00 UTC+1, Massimo Di Pierro wrote: > > what adapter are you using. What is your URI string (without passwords > please)? > Apologies for the slow reply. Annoyingly, I've found that the solution (without copy) doesn't work at the moment. I'm using the

Re: [web2py] Re: Support for BIT(1) as boolean?

2017-09-04 Thread 'Yan Wong' via web2py-users
With this code, I now find that with the latest version of web2py (2.15.4), I get File "applications/XXX/models/db.py", line 46, in db._adapter.types = copy.copy(db._adapter.types) AttributeError: can't set attribute I have deleted the copy.copy line, so that I am modifying the adapter

[web2py] Should html input helpers inject a newline in value param

2017-03-25 Thread 'Yan Wong' via web2py-users
When using the web2py TEXTAREA html helper, I was caught out when displaying text that has an initial newline. This is incorrectly displayed when setting e.g. TEXTAREA(value="\n\nhello"), since the HTML 4 spec (http://www.w3.org/TR/WD-html40-970917/struct/text.html) says "A line break

[web2py] Nginx setup not as recommended

2016-04-08 Thread 'Yan Wong' via web2py-users
The web2py Nginx setup page (http://web2py.com/books/default/chapter/29/13/deployment-recipes#Nginx) says to specify 'root' directory in two 'location' blocks, one for /xxx/static and one for simply / But this is "bad practice" according to the 2nd recommendation in the Nginx docs