Skip to content

Commit

Permalink
Merge pull request Pylons#2178 from srisankethu/patch-1
Browse files Browse the repository at this point in the history
Update url.py
  • Loading branch information
mmerickel committed Dec 15, 2015
2 parents f5846fd + b4fcff0 commit 834a437
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pyramid/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,17 @@ def _partial_application_url(self, scheme=None, host=None, port=None):
if scheme == 'http':
if port is None:
port = '80'
url = scheme + '://'
if port is not None:
port = str(port)
if host is None:
host = e.get('HTTP_HOST')
if host is None:
host = e['SERVER_NAME']
if host is None:
host = e['SERVER_NAME']
if port is None:
if ':' in host:
host, port = host.split(':', 1)
else:
port = e['SERVER_PORT']
else:
port = str(port)
if ':' in host:
host, _ = host.split(':', 1)
if scheme == 'https':
Expand All @@ -117,7 +115,7 @@ def _partial_application_url(self, scheme=None, host=None, port=None):
elif scheme == 'http':
if port == '80':
port = None
url += host
url = scheme + '://' + host
if port:
url += ':%s' % port

Expand Down

0 comments on commit 834a437

Please sign in to comment.