@@ -82,19 +82,31 @@ def __call__(self, value):
8282 if self .allow_hostname_wildcard and "*" in netloc :
8383 domain_parts = netloc .split ("." )
8484 if netloc .count ("*" ) > 1 :
85- raise ValidationError (
86- "%(name)s URI validation error. %(cause)s: %(value)s" ,
87- params = {"name" : self .name , "value" : value , "cause" : "only one wildcard is allowed in the hostname" },
88- )
85+ raise ValidationError (
86+ "%(name)s URI validation error. %(cause)s: %(value)s" ,
87+ params = {
88+ "name" : self .name ,
89+ "value" : value ,
90+ "cause" : "only one wildcard is allowed in the hostname" ,
91+ },
92+ )
8993 if not netloc .startswith ("*" ):
9094 raise ValidationError (
9195 "%(name)s URI validation error. %(cause)s: %(value)s" ,
92- params = {"name" : self .name , "value" : value , "cause" : "wildcards must be at the beginning of the hostname" },
96+ params = {
97+ "name" : self .name ,
98+ "value" : value ,
99+ "cause" : "wildcards must be at the beginning of the hostname" ,
100+ },
93101 )
94102 if len (domain_parts ) < 3 :
95103 raise ValidationError (
96104 "%(name)s URI validation error. %(cause)s: %(value)s" ,
97- params = {"name" : self .name , "value" : value , "cause" : "wildcards cannot be in the top level or second level domain" },
105+ params = {
106+ "name" : self .name ,
107+ "value" : value ,
108+ "cause" : "wildcards cannot be in the top level or second level domain" ,
109+ },
98110 )
99111
100112 # strip the wildcard from the netloc, we'll reassamble the value later to pass to URI Validator
@@ -107,12 +119,20 @@ def __call__(self, value):
107119 if path .count ("*" ) > 1 :
108120 raise ValidationError (
109121 "%(name)s URI validation error. %(cause)s: %(value)s" ,
110- params = {"name" : self .name , "value" : value , "cause" : "only one wildcard is allowed in the path" },
122+ params = {
123+ "name" : self .name ,
124+ "value" : value ,
125+ "cause" : "only one wildcard is allowed in the path" ,
126+ },
111127 )
112128 if not path .endswith ("*" ):
113129 raise ValidationError (
114130 "%(name)s URI validation error. %(cause)s: %(value)s" ,
115- params = {"name" : self .name , "value" : value , "cause" : "wildcards must be at the end of the path" },
131+ params = {
132+ "name" : self .name ,
133+ "value" : value ,
134+ "cause" : "wildcards must be at the end of the path" ,
135+ },
116136 )
117137 # strip the wildcard from the path, we'll reassamble the value later to pass to URI Validator
118138 path = path [:- 1 ]
0 commit comments