@@ -82,19 +82,31 @@ def __call__(self, value):
82
82
if self .allow_hostname_wildcard and "*" in netloc :
83
83
domain_parts = netloc .split ("." )
84
84
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
+ )
89
93
if not netloc .startswith ("*" ):
90
94
raise ValidationError (
91
95
"%(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
+ },
93
101
)
94
102
if len (domain_parts ) < 3 :
95
103
raise ValidationError (
96
104
"%(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
+ },
98
110
)
99
111
100
112
# 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):
107
119
if path .count ("*" ) > 1 :
108
120
raise ValidationError (
109
121
"%(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
+ },
111
127
)
112
128
if not path .endswith ("*" ):
113
129
raise ValidationError (
114
130
"%(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
+ },
116
136
)
117
137
# strip the wildcard from the path, we'll reassamble the value later to pass to URI Validator
118
138
path = path [:- 1 ]
0 commit comments