Marzona / rig-remote

remote control a rig through rigctl protocol
MIT License
21 stars 6 forks source link

refactor is_valid_hostname() in ui.py #32

Closed Marzona closed 8 years ago

Marzona commented 8 years ago

The function relies on the structure of the hostname passed as string. name length, structure of the strings considering dot separation..

I would simply try a name resolution and catch the exception. This will allow us to avoid to bother for new FQDN, ipv6 compatibility and such..

moreover the function should raise exception and not return true/false.

MaineTim commented 8 years ago

commit 01841c1 refactors _is_valid_hostname(), as the original was causing an exception when passed an empty string. Also makes some changes and an addition to test_ui.py also pushed to devel.