Merge branch 'daniel/remove-secure-hostname'
diff --git a/app/melange/appengine/system.py b/app/melange/appengine/system.py
index 11845c8..b84b36f 100644
--- a/app/melange/appengine/system.py
+++ b/app/melange/appengine/system.py
@@ -47,11 +47,6 @@
return os.environ.get('HTTP_HOST', '')
-def getSecureHostname():
- """Returns the hostname suitable for https requests."""
- return "%s.appspot.com" % getApplicationId()
-
-
def getAppVersion():
"""Returns the Google App Engine "version" of the running instance."""
return os.environ.get('CURRENT_VERSION_ID')
diff --git a/app/melange/request/links.py b/app/melange/request/links.py
index 7696537..6204510 100644
--- a/app/melange/request/links.py
+++ b/app/melange/request/links.py
@@ -18,7 +18,6 @@
from django.core import urlresolvers
-from melange.appengine import system
from melange.models import organization as org_model
from soc.logic import program as program_logic
@@ -38,11 +37,7 @@
A full path to the resource.
"""
# TODO(nathaniel): consider using scheme-relative urls here?
- if secure:
- protocol = 'https'
- hostname = system.getSecureHostname()
- else:
- protocol = 'http'
+ protocol = 'https' if secure else 'http'
return '%s://%s%s' % (protocol, hostname, relative_url)
diff --git a/app/soc/views/helper/request_data.py b/app/soc/views/helper/request_data.py
index 18e6cd0..ce91079 100644
--- a/app/soc/views/helper/request_data.py
+++ b/app/soc/views/helper/request_data.py
@@ -811,12 +811,8 @@
return url
# TODO(nathaniel): consider using scheme-relative urls here?
- if secure:
- protocol = 'https'
- hostname = system.getSecureHostname()
- else:
- protocol = 'http'
- hostname = site_logic.getHostname(self._data)
+ protocol = 'https' if secure else 'http'
+ hostname = site_logic.getHostname(self._data)
return '%s://%s%s' % (protocol, hostname, url)
diff --git a/tests/app/melange/appengine/test_system.py b/tests/app/melange/appengine/test_system.py
index ddc4c29..c03a404 100644
--- a/tests/app/melange/appengine/test_system.py
+++ b/tests/app/melange/appengine/test_system.py
@@ -109,18 +109,6 @@
else:
os.environ['HTTP_HOST'] = self.default_host
- def testGetSecureHostName(self):
- """Tests that a hostname suitable for https requests is returned."""
- try:
- os.environ['APPLICATION_ID'] = 'test-app-run'
- expected_host = 'test-app-run.appspot.com'
- self.assertEqual(system.getSecureHostname(), expected_host)
- finally:
- if self.default_application_id is None:
- del os.environ['APPLICATION_ID']
- else:
- os.environ['APPLICATION_ID'] = self.default_application_id
-
def testGetAppVersion(self):
"""Tests if a google-app-version is returned."""
try: