500 From API when PUT with Empty Tags #1887

Closed
opened 2025-12-29 17:20:04 +01:00 by adam · 1 comment
Owner

Originally created by @zachmoody on GitHub (Aug 2, 2018).

Environment

  • Python version: 2.7
  • NetBox version: 2.4-dev

Steps to Reproduce

Calling PUT on (at least) a Site object with no tags yields a 500.

Observed Behavior

This is the traceback returned:
traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/usr/src/app/extras/middleware.py", line 82, in __call__
    obj.log_change(request.user, request.id, action)
  File "/usr/src/app/utilities/models.py", line 38, in log_change
    object_data=serialize_object(self)
  File "/usr/src/app/utilities/utils.py", line 105, in serialize_object
    data['tags'] = [tag.name for tag in obj.tags.all()]
AttributeError: 'list' object has no attribute 'all'

example payload:

{u'asn': 321,
 u'comments': u'',
 u'contact_email': u'',
 u'contact_name': u'',
 u'contact_phone': u'',
 u'count_circuits': 0,
 u'count_devices': 0,
 u'count_prefixes': 0,
 u'count_racks': 0,
 u'count_vlans': 0,
 u'created': u'2018-08-02',
 u'custom_fields': {},
 u'description': u'',
 u'facility': u'',
 u'id': 1,
 u'last_updated': u'2018-08-02T14:47:45.841002Z',
 u'latitude': None,
 u'longitude': None,
 u'name': u'TEST',
 u'physical_address': u'',
 u'region': None,
 u'shipping_address': u'',
 u'slug': u'test',
 u'status': 1,
 u'tags': [],
 u'tenant': None,
 u'time_zone': u'Africa/Abidjan'}
Originally created by @zachmoody on GitHub (Aug 2, 2018). <!-- NOTE: This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 2.7 * NetBox version: 2.4-dev <!-- Describe in detail the steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). --> ### Steps to Reproduce Calling PUT on (at least) a Site object with no tags yields a 500. <!-- What happened instead? --> ### Observed Behavior This is the traceback returned: traceback: ``` Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/usr/src/app/extras/middleware.py", line 82, in __call__ obj.log_change(request.user, request.id, action) File "/usr/src/app/utilities/models.py", line 38, in log_change object_data=serialize_object(self) File "/usr/src/app/utilities/utils.py", line 105, in serialize_object data['tags'] = [tag.name for tag in obj.tags.all()] AttributeError: 'list' object has no attribute 'all' ``` example payload: ``` {u'asn': 321, u'comments': u'', u'contact_email': u'', u'contact_name': u'', u'contact_phone': u'', u'count_circuits': 0, u'count_devices': 0, u'count_prefixes': 0, u'count_racks': 0, u'count_vlans': 0, u'created': u'2018-08-02', u'custom_fields': {}, u'description': u'', u'facility': u'', u'id': 1, u'last_updated': u'2018-08-02T14:47:45.841002Z', u'latitude': None, u'longitude': None, u'name': u'TEST', u'physical_address': u'', u'region': None, u'shipping_address': u'', u'slug': u'test', u'status': 1, u'tags': [], u'tenant': None, u'time_zone': u'Africa/Abidjan'} ```
adam added the type: bug label 2025-12-29 17:20:04 +01:00
adam closed this issue 2025-12-29 17:20:04 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 3, 2018):

Fixed in #2297

@jeremystretch commented on GitHub (Aug 3, 2018): Fixed in #2297
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1887