Skip to content

Commit

Permalink
Use the server port as well when constructing a full path.
Browse files Browse the repository at this point in the history
  • Loading branch information
Borko Jandras committed Jul 1, 2012
1 parent 4aabd83 commit 1477ffc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion objavi/cgi_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def url2path(url):

_htdocs = os.path.abspath(config.HTDOCS)
SERVER_NAME = os.environ.get('SERVER_NAME', 'localhost')
SERVER_PORT = os.environ.get('SERVER_PORT', '80')

def path2url(path, default='/missing_path?%(path)s', full=False):
"""convert local file paths to htdocs-relative addresses. If the
Expand All @@ -102,7 +103,7 @@ def path2url(path, default='/missing_path?%(path)s', full=False):
else:
path = default % {'path': urllib.quote(path)}
if full:
return 'http://%s%s' % (SERVER_NAME, path)
return 'http://%s:%s%s' % (SERVER_NAME, SERVER_PORT, path)
return path


Expand Down

0 comments on commit 1477ffc

Please sign in to comment.