Skip to content

Commit

Permalink
Ensure that SERVICE_FIX has trailing slash.
Browse files Browse the repository at this point in the history
Fixes Issue jupyterhub#997. Also updated Traitlets to 4.3.2 since the change in singleuser.py relies on trait default values being checked through validator, which was added in traitlets 4.3.2.
  • Loading branch information
whitead committed Feb 27, 2017
1 parent b47f76c commit 2fb503d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jupyterhub/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def server(self):

@property
def prefix(self):
return url_path_join(self.base_url, 'services', self.name)
return url_path_join(self.base_url, 'services', self.name + '/')

@property
def proxy_path(self):
Expand Down
11 changes: 11 additions & 0 deletions jupyterhub/singleuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,17 @@ def _hub_api_url_default(self):
def _base_url_default(self):
return os.environ.get('JUPYTERHUB_SERVICE_PREFIX') or '/'

#Note: this may be removed if notebook module is >= 5.0.0b1
@validate('base_url')
def _validate_base_url(self, proposal):
"""ensure base_url starts and ends with /"""
value = proposal.value
if not value.startswith('/'):
value = '/' + value
if not value.endswith('/'):
value = value + '/'
return value

@default('cookie_name')
def _cookie_name_default(self):
if os.environ.get('JUPYTERHUB_SERVICE_NAME'):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
alembic
traitlets>=4.3
traitlets>=4.3.2
tornado>=4.1
jinja2
pamela
Expand Down

0 comments on commit 2fb503d

Please sign in to comment.