Skip to content

Conversation

@rbeneyt
Copy link
Contributor

@rbeneyt rbeneyt commented Mar 31, 2020

Hi Fergal, I added dev server port on cmdline as you asked.

Copy link
Owner

@fergalwalsh fergalwalsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. See the minor comments.

pico/server.py Outdated
Comment on lines 50 to 56
except ValueError:
try:
server_port = socket.getservbyname(server_port, 'tcp')

# OSError in python3, but error in python2.7.
except Exception:
server_port = DEF_SERVER_PORT
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to handle named ports. It seems like quite an uncommon use case.

If we get a ValueError we should raise a TypeError to inform the user that the port part of the string was not a valid port. e.g.:
raise TypeError('Invalid port number specified.')

pico/server.py Outdated
from werkzeug.middleware.shared_data import SharedDataMiddleware
from werkzeug.utils import import_string

DEF_SERVER_IP = '127.0.0.1'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for using constants for these but please let's use DEFAULT_SERVER_IP & DEFAULT_SERVER_PORT. Or maybe simply DEFAULT_IP & DEFAULT_PORT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Fergal, Added a new commit with the changes you requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants