KeyError in content_types_provided when using wm.route decorator
@benoitc đang làm issue này rồi.
Từ ngày 4/5/2011.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
When you use the decorator wm.route on a function to register a new route, the WM implementation of the content_types_provided method can generate a KeyError if the request method is not in the wm methods dictionary.
For example, using the helloworld2 example included in the project, if you send a POST request on the root url:
curl -X POST http://localhost:8000/
a KeyError is raised:
File "/Users/Ludo/prog/django/core/handlers/base.py", line 111, in get_response
response = callback(request, _callback_args, *_callback_kwargs)
File "/Users/Ludo/prog/django/webmachine/resource.py", line 646, in **call**
return self._process(request, _args, *_kwargs)
File "/Users/Ludo/prog/django/webmachine/resource.py", line 605, in _process
ctypes = [ct for (ct, func) in (self.content_types_provided(req, resp) or [])]
File "/Users/Ludo/prog/django/webmachine/route.py", line 208, in content_types_provided
fun = self.methods[req.method]
KeyError: 'POST'
I am not sure about a fix, but either checking earlier in resource.Resource._process for not allowed method or directly in the content_types_provided should be fine.
- Ngôn ngữ chính
- Python
- Star
- 58
- Fork
- 8
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của benoitc/dj-webmachine
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
benoitc/dj-webmachine#12 ·
-
if-modified-since UTCĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
benoitc/dj-webmachine#11 ·
-
Bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
benoitc/dj-webmachine#10 ·
-
Add JSONP supportĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
benoitc/dj-webmachine#2 · 6 bình luận ·
Tất cả issue của benoitc/dj-webmachine
Issue tương tự
-
agents nolte-linux security skills
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nolte/claude-shared#732 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] Source archive filter: dry run excludes SystemVerilog (.sv) files with no preflight warningĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
FinanceFlash/unvibecode#906 ·
Maintainer thường phản hồi trong vòng 1 ngày