(self, cls=None)
| 249 | message = "method not allowed" |
| 250 | |
| 251 | def __init__(self, cls=None): |
| 252 | status = "405 Method Not Allowed" |
| 253 | headers = {} |
| 254 | headers["Content-Type"] = "text/html" |
| 255 | |
| 256 | methods = ["GET", "HEAD", "POST", "PUT", "DELETE"] |
| 257 | if cls: |
| 258 | methods = [method for method in methods if hasattr(cls, method)] |
| 259 | |
| 260 | headers["Allow"] = ", ".join(methods) |
| 261 | HTTPError.__init__(self, status, headers, self.message) |
| 262 | |
| 263 | |
| 264 | nomethod = NoMethod |