Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 7, 2010 15:26:21

K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Post URL characters problem


Hi,
if you have
<form method="POST" action="/blabla/topic/reply/114-test%20?/"
id="addReplyForm" name="addReplyForm">
...
</form>

when the form is submitted, django complains about this :
Request Method: POST
Request URL:http://mysite/blabla/topic/reply/114-test%20?/Django Version: 1.3 pre-alpha SVN-13865
Exception Type: RuntimeError
Exception Value:

You called this URL via POST, but the URL doesn't end in a slash and
you have APPEND_SLASH set.

REQUEST_URI '/blabla/topic/reply/114-test%20?/'
PATH_INFO u'/blabla/topic/reply/114-test '
PATH_TRANSLATED '/my.wsgi/blabla/topic/reply/114-test '

can anyone tell if this is a bug of django ?

thanx.
Keats.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 7, 2010 15:31:00

Tom E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Post URL characters problem


On Tue, Dec 7, 2010 at 3:26 PM, Keats <neoke...@gmail.com> wrote:
> Hi,
> if you have
> <form method="POST" action="/blabla/topic/reply/114-test%20?/"
> id="addReplyForm" name="addReplyForm">
> ...
> </form>
>
> when the form is submitted, django complains about this :
> Request Method:         POST
> Request URL:http://mysite/blabla/topic/reply/114-test%20?/> Django Version:         1.3 pre-alpha SVN-13865
> Exception Type:         RuntimeError
> Exception Value:
>
> You called this URL via POST, but the URL doesn't end in a slash and
> you have APPEND_SLASH set.
>
> REQUEST_URI     '/blabla/topic/reply/114-test%20?/'
> PATH_INFO       u'/blabla/topic/reply/114-test '
> PATH_TRANSLATED         '/my.wsgi/blabla/topic/reply/114-test '
>
> can anyone tell if this is a bug of django ?
>
> thanx.
> Keats.
>

Why do you think it is a bug? The URL doesn't match one in your
urlconf, but would with an appended slash, which is missing from the
URL (the '/' in your URL is part of the query string). Since this is a
POST request, it cannot redirect without losing data, so it is a
runtime error.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 7, 2010 15:58:16

K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Post URL characters problem


the urlpattern is :
^'/blabla/topic/(?P<topic_id>\d+)-(?P<topic_name>.*)/$

and i think it's a bug because if you see request URL there is a
slash
and if it was an urlconf problem django would have reply url not
found.
i think the problem is linked to the fact that the test topic ends
with "?" and for some reason django is bothered by it...
maybe because "?..."are usually processed has get variables...

thanx
Keats.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Dec. 7, 2010 16:00:21

Tom E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Post URL characters problem


As I explained in my original email, the URL in your example _DOES
NOT_ end in a slash. It has a query string that ends with a slash
which is _NOT_ the same thing.

Sorry to shout, but I explained it quite clearly before :/

Cheers

Tom

On Tue, Dec 7, 2010 at 3:50 PM, Keats <neoke...@gmail.com> wrote:
> the urlpattern is :
> ^'/blabla/topic/(?P<topic_id>\d+)-(?P<topic_name>.*)/$
>
> and i think it's a bug because if you see request URL there is a
> slash
> and if it was an urlconf problem django would have reply url not
> found.
> i think the problem is linked to the fact that the test topic ends
> with "?" and for some reason django is bothered by it...
> maybe because "?..."are usually processed has get variables...
>
> thanx
> Keats.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Dec. 8, 2010 09:13:16

K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Post URL characters problem


hi,
How i can add it then ?

i was thinking that the problem is "?" because :
<form method="POST" action="/blabla/topic/reply/115-test%20/%20test/"
id="addReplyForm" name="addReplyForm">
works perfectly any other characters in the topic_name part seems to
work and since i'm only using : (.*) i didn't see how it could be an
URL mismatch matter because for me (.*) means match everything ...

thanx.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 Dec. 8, 2010 11:30:13

bruno d.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Post URL characters problem


On 8 déc, 10:13, Keats <neoke...@gmail.com> wrote:
> hi,
> How i can add it then ?
>
> i was thinking that the problem is "?" because :

It is. Please refer to the relevant RFC: the question mark is a
reserved character used to specify the beginning of a querystring. If
you want it to be part of the url itself, you do have to properly
quote it (using django.utils.http.urlquote or the corresponding
template tag).

> <form method="POST" action="/blabla/topic/reply/115-test%20/%20test/"
> id="addReplyForm" name="addReplyForm">
> works perfectly any other characters in the topic_name part seems to
> work and since i'm only using : (.*) i didn't see how it could be an
> URL mismatch matter because for me (.*) means match everything ...

The url regexp is matched against the "path" part of the url - the
querystring is ignored at this point.



--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#7 Dec. 8, 2010 14:57:01

K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Post URL characters problem


tanks !
the filter urlencode did the trick.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 14th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support