Skip to content

Underscores in slugs are converted to hyphens #715

@thomaschristory

Description

@thomaschristory

pynetbox version

v7.5.0

NetBox version

v4.4.5

Python version

3.11

Steps to Reproduce

I am using netbox 4.4.x and the custom objects plugins and I am running in an issue exactly like #653

I tend to name my objects with underscores (as in object_for_something), probably because I do too much python, and it prevents pynetbox from working there as it converts underscores to hyphens.
This is easily visible in the request part of a pynetbox object.

I am not sure if pynetbox should be flexible, or if netbox should enforce - instead of _ in slugs ?

It's pretty easy to reproduce, create a custom object and name the slug with an underscore, then try to call it via pynetbox.

Happy to provide more details if needed.

Expected Behavior

If I call my object that has underscores in the slug, I expect the lib to reflect the underscores in the naming :
'https://netbox/api/plugins/custom-objects/my_first_custom_object/'

Observed Behavior

The url for the request is converted like so :
'https://netbox/api/plugins/custom-objects/my-first-custom-object/'

Metadata

Metadata

Assignees

No one assigned

    Labels

    app: pynetboxstatus: under reviewFurther discussion is needed to determine this issue's scope and/or implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions