Re: misreporting verify_exists

2008-12-06 Thread Malcolm Tredinnick


On Sun, 2008-12-07 at 12:02 +0800, Eric Abrahamsen wrote:
[...]
> Thanks for the response, Malcolm. I wonder if I'm looking at the wrong  
> part of the code? forms.fields.URLField.clean() seems to be using a  
> full urllib2.urlopen, not just a HEAD request -- am I looking at the  
> wrong code?

Yeah, looks like you're right. *shrug* In any case, that's not your
problem. Requests to that URL go through fine, whether HEAD or GET. I
even tried it using the user agent that Django would send (unless you
reconfigured it in your settings file) and it worked.

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: misreporting verify_exists

2008-12-06 Thread Eric Abrahamsen


On Dec 7, 2008, at 11:44 AM, Malcolm Tredinnick wrote:

>
>
> On Sun, 2008-12-07 at 14:42 +1100, Malcolm Tredinnick wrote:
> [...]
>
>> So have a look at the result of something like "curl -I http://...
>> " (or
>> equivalent tool if you don't have curl around). Basically, force a  
>> HEAD
>> request and see if that returns something sensible.
>
> Ignore me. I completely missed that you'd given the link. I tried the
> HEAD request and it returned a 200 response. So that isn't it. So I  
> have
> no idea. Sorry for the noise.

Thanks for the response, Malcolm. I wonder if I'm looking at the wrong  
part of the code? forms.fields.URLField.clean() seems to be using a  
full urllib2.urlopen, not just a HEAD request -- am I looking at the  
wrong code?

Eric


>
>
> Malcolm
>
>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: misreporting verify_exists

2008-12-06 Thread Malcolm Tredinnick


On Sun, 2008-12-07 at 14:42 +1100, Malcolm Tredinnick wrote:
[...]

> So have a look at the result of something like "curl -I http://...
> " (or
> equivalent tool if you don't have curl around). Basically, force a HEAD
> request and see if that returns something sensible.

Ignore me. I completely missed that you'd given the link. I tried the
HEAD request and it returned a 200 response. So that isn't it. So I have
no idea. Sorry for the noise.

Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: misreporting verify_exists

2008-12-06 Thread Malcolm Tredinnick


On Sun, 2008-12-07 at 11:32 +0800, Eric Abrahamsen wrote:
> I've got a model with a URLField, with verify_exists set to True,  
> which has suddenly started barfing "broken link" on a certain URL. I'm  
> quite sure the URL exists, and can't figure out why it can't get past  
> validation. This is the link:
> 
> http://www.rochester.edu/College/translation/threepercent/index.php?id=1482
> 
> The URLField itself is nothing special (unique=True, that's all). I  
> get the same error in development and production, though using urllib  
> on my production machine opens the URL fine, and I can open it in a  
> browser on my development machine. I started a Python interpreter and  
> manually typed in most of what goes on in  
> forms.fields.URLField.clean() (minus the User Agent stuff, don't know  
> what that is), and it opened with no problem. When the validation  
> error comes back in the Admin interface, the url hasn't been truncated  
> or altered in any way, so I don't think that's it. I've entered URLs  
> with GET parameters before...
> 
> I can't think of anything else! Has someone got a bright idea? I'm  
> running 1.1 pre-alpha SVN-9569.

Verify_exists uses an HTTP HEAD request to check the existence, since it
doesn't need the whole page. Some web browsers are misconfigured and
report 404 for URLS when a HEAD request is made, but not for the same
resource via a GET request.

So have a look at the result of something like "curl -I http://... " (or
equivalent tool if you don't have curl around). Basically, force a HEAD
request and see if that returns something sensible.

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---