experchange > python

Νίκος Βέργος (03-06-20, 03:33 PM)
First i must say i use Bottle, but the same may also be the case in Flask too. I ask here and not in sub Bottle because there are only a few people there and i receive no responses.

Actualy since i started here let me say what i have found.

Iam just trying to post html form data to the following endpoint.

@app.route( '/mailform', method=['POST'] )
IF i try to post the html form data using the the endpoint url way, i get "Method NOT Allowed" error:

<form method="POST" action="/mailform">

WHILE if i try the following way, i receive no error.

<form method="POST" action="%s"> ...html... </form>''' % app.get_url( '/mailform )

Can someone explain why?!
DL Neil (03-07-20, 12:33 AM)
On 7/03/20 2:33 AM, Νίκος Βέργος wrote:
> First i must say i use Bottle, but the same may also be the case in Flask too. I ask here and not in sub Bottle because there are only a few people there and i receive no responses.
> Actualy since i started here let me say what i have found.
> Iam just trying to post html form data to the following endpoint.
> @app.route( '/mailform', method=['POST'] )
> IF i try to post the html form data using the the endpoint url way, i get "Method NOT Allowed" error:
> <form method="POST" action="/mailform">
> WHILE if i try the following way, i receive no error.
> <form method="POST" action="%s"> ...html... </form>''' % app.get_url( '/mailform )
> Can someone explain why?!


Please post the full error message and traceback.

To clarify: is the error coming from Python or from the web server?
Νίκος Βέργος (03-07-20, 12:15 PM)
Τη Σάββατο, 7 Μαρτίου 2020 - 12:34:21 π.μ. UTC+2, ο χρήστης DL Neil έγραψε:

> Please post the full error message and traceback.
> To clarify: is the error coming from Python or from the web server?


I beleive it comes from the web server. Here it is:

Error: 500 Internal Server Error
Sorry, the requested URL 'http://superhost.gr/mailform' caused an error:

Internal Server Error
Exception:
TypeError("argument of type 'NoneType' is not iterable",)
Traceback:
Traceback (most recent call last):
File "/home/nikos/wsgi/bottle.py", line 996, in _handle
out = route.call(**args)
File "/home/nikos/wsgi/bottle.py", line 2007, in wrapper
rv = callback(*a, **ka)
File "/home/nikos/wsgi/www.py", line 189, in mailform
if provider in FROM:
TypeError: argument of type 'NoneType' is not iterable

I somehow beleive that the following apache conf directives somehow create problem.

When superhost.gr/test tries to post html form data to the route endpoint '/mailform' it sends it to superhost.gr/mailform and NOT at superhost.gr/test/mailform as it should have done.

They somehow interfere.

Here is the processes running in the webserver that somehow interfere.

WSGIDaemonProcess test user=nikos group=nikos home=/home/nikos/wsgi
WSGIScriptAlias /test /home/nikos/wsgi/test.py process-group=test application-group=%{GLOBAL}

WSGIDaemonProcess www user=nikos group=nikos home=/home/nikos/wsgi
WSGIScriptAliasMatch / /home/nikos/wsgi/www.py process-group=www application-group=%{GLOBAL}
Νίκος Βέργος (03-07-20, 03:10 PM)
You will see if you create a route endpoint called 'mailform' within '/' which is an alias of 'www.py' and you also have '/mailform' in 'superhost.gr/test' when the latter tries to post data to '/mailform' instead of sending them to 'superhost.gr/test/' it sends them to '/' which is 'superhost.gr'
Richard Damon (03-07-20, 09:47 PM)
On 3/7/20 5:15 AM, Νίκος Βέργος wrote:
> When superhost.gr/test tries to post html form data to the route endpoint '/mailform' it sends it to superhost.gr/mailform and NOT at superhost.gr/test/mailform as it should have done.

The HTML path /mailform means server relative path, so the path is
relative to the SERVER, not the current page, so it would be
superhost.gr/mailform

The other format goes through a function which might re-interpret the
path and either make it page relative or add in the path of the current
page to get to /test/mailform
Similar Threads