Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store IP addresses as netaddr.IPAddress instead of str #17

Open
benediktkr opened this issue Sep 27, 2014 · 0 comments
Open

Store IP addresses as netaddr.IPAddress instead of str #17

benediktkr opened this issue Sep 27, 2014 · 0 comments

Comments

@benediktkr
Copy link
Owner

Wherever ip addresses are stored, we should use netaddr.IPAddress instead of the standard Python str.

>>> ip = IPAddress("1.1.1.1")
>>> ip
IPAddress('1.1.1.1')
>>> str(ip)
'1.1.1.1'
>>> repr(ip)
"IPAddress('1.1.1.1')" 
>>>

Although we might want to override IPAddress.__repr__() to return IPAddress.__str__().

Currently, this is possible

>>> vpn31 = model.Node.get("vpn31")  
>>> vpn31.ip = "79.134.237.10722"
>>> vpn31.save() 
>>> model.Node.get("vpn31")
{'name': 'vpn31', .... , 'ip': '79.134.237.10722'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant