[PR #11556] [CLOSED] 11539 empty lookup handle non boolean params #13808

Closed
opened 2025-12-29 23:20:55 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/11556
Author: @arthanson
Created: 1/20/2023
Status: Closed

Base: developHead: 11539-boolean-filters


📝 Commits (1)

  • 10b8904 11539 empty lookup handle non boolean params

📊 Changes

1 file changed (+12 additions, -1 deletions)

View changed files

📝 netbox/extras/lookups.py (+12 -1)

📄 Description

Fixes: #11539

The issue requested that a 404 be returned, but IMHO this is not consistent with how other filter params work, if you filter on "region_id=ss" it won't 404 but just return no values from the query. This change uses strtobool "True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0" for anything else it interprets it as false. Also cleaned up the return string to make it a bit easier to read what exactly is going on. Unfortunately strtobool raises a ValueError if the string doesn't match a valid input, so needed to wrap that.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/11556 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 1/20/2023 **Status:** ❌ Closed **Base:** `develop` ← **Head:** `11539-boolean-filters` --- ### 📝 Commits (1) - [`10b8904`](https://github.com/netbox-community/netbox/commit/10b89044819b744bb1116c05d242f9393936b6d3) 11539 empty lookup handle non boolean params ### 📊 Changes **1 file changed** (+12 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/lookups.py` (+12 -1) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #11539 <!-- Please include a summary of the proposed changes below. --> The issue requested that a 404 be returned, but IMHO this is not consistent with how other filter params work, if you filter on "region_id=ss" it won't 404 but just return no values from the query. This change uses strtobool "True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0" for anything else it interprets it as false. Also cleaned up the return string to make it a bit easier to read what exactly is going on. Unfortunately strtobool raises a ValueError if the string doesn't match a valid input, so needed to wrap that. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:20:55 +01:00
adam closed this issue 2025-12-29 23:20:55 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13808