]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Raise useful exception when called with URL for which request type
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 9 May 2001 15:49:24 +0000 (15:49 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 9 May 2001 15:49:24 +0000 (15:49 +0000)
cannot be determined.

Pseudo-fix for SF bug #420724

Lib/urllib2.py

index 042f2ba6f2c3415d238345f28aa8ce4f63096fb3..992c83b5a1d99e42b27b5a5d7f4d104e0f207aad 100644 (file)
@@ -217,7 +217,8 @@ class Request:
     def get_type(self):
         if self.type is None:
             self.type, self.__r_type = splittype(self.__original)
-            assert self.type is not None, self.__original
+            if self.type is None:
+                raise ValueError, "unknown url type: %s" % self.__original
         return self.type
 
     def get_host(self):