Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Backend bails out when submitting query without data source: `KeyError: 'datasource'`

Đang mở Phù hợp với người mới
#149 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu tại patzilla/navigator/services/util.py, ở query_expression_util_handler và make_expression_filter, nơi traceback cho thấy mã đang truy cập khóa 'datasource' bị thiếu. Theo dõi cách yêu cầu truy vấn được xác thực và xử lý khi không có nguồn dữ liệu nào được chọn, sau đó thêm hoặc cập nhật một bài kiểm thử tập trung cho yêu cầu đó. Hoàn tất khi gửi một truy vấn như vậy không còn gây ra KeyError ở backend.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

Navigating around wildly, I have been able to submit a query without selecting a data source, which currently makes the backend bail out.

Details

2026-10-27 13:49:04,182 ERROR    [waitress                                ][waitress-2] Exception while serving /api/util/query-expression
Traceback (most recent call last):
  File "/path/to/site-packages/waitress/channel.py", line 430, in service
    task.service()
    ~~~~~~~~~~~~^^
  File "/path/to/site-packages/waitress/task.py", line 167, in service
    self.execute()
    ~~~~~~~~~~~~^^
  File "/path/to/site-packages/waitress/task.py", line 435, in execute
    app_iter = self.channel.server.application(environ, start_response)
  File "/path/to/site-packages/waitress/proxy_headers.py", line 64, in translate_proxy_headers
    return app(environ, start_response)
  File "/path/to/site-packages/paste/deploy/config.py", line 306, in __call__
    return self.app(environ, start_response)
           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/site-packages/pyramid/router.py", line 274, in __call__
    response = self.execution_policy(environ, self)
  File "/path/to/site-packages/pyramid/router.py", line 283, in default_execution_policy
    return request.invoke_exception_view(reraise=True)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/path/to/site-packages/pyramid/view.py", line 787, in invoke_exception_view
    reraise_(*exc_info)
    ~~~~~~~~^^^^^^^^^^^
  File "/path/to/site-packages/pyramid/_compat.py", line 178, in reraise
    raise value.with_traceback(tb)
  File "/path/to/site-packages/pyramid/router.py", line 281, in default_execution_policy
    return router.invoke_request(request)
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/path/to/site-packages/pyramid/router.py", line 249, in invoke_request
    response = handle_request(request)
  File "/path/to/site-packages/pyramid/tweens.py", line 43, in excview_tween
    response = _error_handler(request, exc)
  File "/path/to/site-packages/pyramid/tweens.py", line 13, in _error_handler
    response = request.invoke_exception_view(exc_info)
  File "/path/to/site-packages/pyramid/view.py", line 774, in invoke_exception_view
    response = _call_view(
        registry,
    ...<7 lines>...
        request_iface=request_iface.combined,
    )
  File "/path/to/site-packages/pyramid/view.py", line 683, in _call_view
    response = view_callable(context, request)
  File "/path/to/site-packages/pyramid/viewderivers.py", line 401, in viewresult_to_response
    result = view(context, request)
  File "/path/to/site-packages/pyramid/tweens.py", line 41, in excview_tween
    response = handler(request)
  File "/path/to/site-packages/pyramid/router.py", line 147, in handle_request
    response = _call_view(
        registry, request, context, context_iface, view_name
    )
  File "/path/to/site-packages/pyramid/view.py", line 683, in _call_view
    response = view_callable(context, request)
  File "/path/to/site-packages/pyramid/config/views.py", line 169, in __call__
    return view(context, request)
  File "/path/to/site-packages/pyramid/config/views.py", line 188, in attr_view
    return view(context, request)
  File "/path/to/site-packages/pyramid/config/views.py", line 214, in predicate_wrapper
    return view(context, request)
  File "/path/to/site-packages/pyramid/viewderivers.py", line 436, in rendered_view
    result = view(context, request)
  File "/path/to/site-packages/pyramid/viewderivers.py", line 144, in _requestonly_view
    response = view(request)
  File "/path/to/site-packages/cornice/service.py", line 493, in wrapper
    response = view_(request)
  File "/path/to/patzilla/patzilla/navigator/services/util.py", line 60, in query_expression_util_handler
    expression_data = make_expression_filter(data)
  File "/path/to/patzilla/patzilla/navigator/services/util.py", line 69, in make_expression_filter
    datasource = data['datasource']
                 ~~~~^^^^^^^^^^^^^^
KeyError: 'datasource'
Ngôn ngữ chính
Python
Star
123
Fork
31
Merge trung bình
1 giờ 6 phút
Pull request đã merge (30 ngày)
50

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ip-tools/patzilla

Tất cả issue của ip-tools/patzilla

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.