revert wrong head
authorSverre Rabbelier <sverre@rabbelier.nl>
Mon, 07 Sep 2009 20:26:39 +0200
changeset 2871 e440e94a874b
parent 2869 1ac6a1e1e429
child 2878 cf4b80992451
revert wrong head
app/soc/cache/home.py
app/soc/logic/helper/notifications.py
app/soc/logic/system.py
app/soc/modules/ghop/tasks/task_update.py
app/soc/tasks/surveys.py
app/soc/views/helper/requests.py
app/soc/views/models/org_app.py
app/soc/views/models/program.py
scripts/interactive.py
--- a/app/soc/cache/home.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/app/soc/cache/home.py	Mon Sep 07 20:26:39 2009 +0200
@@ -27,7 +27,6 @@
 from google.appengine.api import memcache
 
 from soc.logic import accounts
-from soc.logic import system
 
 import soc.cache.base
 
@@ -36,12 +35,7 @@
   """Returns the memcache key for an entities homepage.
   """
 
-  host = system.getHostname()
-  version = system.getAppVersion()
-  kind = entity.kind()
-  key = entity.key().id_or_name()
-
-  return 'homepage_for_%s_%s_%s_%s' % (host, version, kind, key)
+  return 'homepage_for_%s_%s' % (entity.kind(), entity.key().id_or_name())
 
 
 def get(self, *args, **kwargs):
--- a/app/soc/logic/helper/notifications.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/app/soc/logic/helper/notifications.py	Mon Sep 07 20:26:39 2009 +0200
@@ -22,6 +22,7 @@
   ]
 
 
+import os
 import time
 
 from django.template import loader
@@ -33,7 +34,6 @@
 from soc.logic import accounts
 from soc.logic import dicts
 from soc.logic import mail_dispatcher
-from soc.logic import system
 from soc.views.helper import redirects
 
 
@@ -81,7 +81,7 @@
   to_user = user_logic.getForFields(properties, unique=True)
 
   invitation_url = "http://%(host)s%(index)s" % {
-      'host' : system.getHostname(),
+      'host' : os.environ['HTTP_HOST'],
       'index': redirects.getInviteProcessRedirect(entity, None),
       }
 
@@ -164,7 +164,7 @@
   url = "http://%(host)s%(redirect)s" % {
       'redirect': redirects.getApplicantRedirect(entity,
       {'url_name': params['group_url_name']}),
-      'host': system.getHostname(),
+      'host': os.environ['HTTP_HOST'],
       }
 
   message_properties = {
@@ -269,7 +269,7 @@
 
   # create the url to show this notification
   notification_url = "http://%(host)s%(index)s" % {
-      'host' : system.getHostname(),
+      'host' : os.environ['HTTP_HOST'],
       'index': redirects.getPublicRedirect(notification_entity,
           notification_view.getParams())}
 
@@ -340,7 +340,7 @@
           'name': user_entity.name
           },
       'site_name': site_name,
-      'site_location': 'http://%s' % system.getHostname(),
+      'site_location': 'http://%s' % os.environ['HTTP_HOST'],
       }
 
   # send out the message using the default welcome template
--- a/app/soc/logic/system.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/app/soc/logic/system.py	Mon Sep 07 20:26:39 2009 +0200
@@ -26,12 +26,6 @@
 import settings
 
 
-def getHostname():
-  """Returns the hostname
-  """
-
-  return os.environ.get('HTTP_HOST')
-
 def getAppVersion():
   """Returns the Google App Engine "version" of the running instance.
   """
--- a/app/soc/modules/ghop/tasks/task_update.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/app/soc/modules/ghop/tasks/task_update.py	Mon Sep 07 20:26:39 2009 +0200
@@ -23,6 +23,7 @@
 
 
 import logging
+import os
 
 from google.appengine.api.labs import taskqueue
 from google.appengine.ext import db
@@ -30,7 +31,6 @@
 from django import http
 from django.utils.translation import ugettext
 
-from soc.logic import system
 from soc.tasks.helper import error_handler
 from soc.views.helper import redirects
 
@@ -180,7 +180,7 @@
       subscriber_start_index:subscriber_start_index+batch_size])
 
   task_url = "http://%(host)s%(task)s" % {
-                 'host': system.getHostname(),
+                 'host': os.environ['HTTP_HOST'],
                  'task': redirects.getPublicRedirect(
                      task_entity, {'url_name': 'ghop/task'}),
                  }
--- a/app/soc/tasks/surveys.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/app/soc/tasks/surveys.py	Mon Sep 07 20:26:39 2009 +0200
@@ -23,13 +23,13 @@
 
 
 import logging
+import os
 
 from google.appengine.api.labs import taskqueue
 
 from django import http
 
 from soc.tasks.helper import error_handler
-from soc.logic import system
 
 
 def getDjangoURLPatterns():
@@ -222,7 +222,7 @@
 
     survey_url = "http://%(host)s%(redirect)s" % {
       'redirect': survey_redirect,
-      'host': system.getHostname(),
+      'host': os.environ['HTTP_HOST'],
       }
 
     # set the context for the mail template
--- a/app/soc/views/helper/requests.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/app/soc/views/helper/requests.py	Mon Sep 07 20:26:39 2009 +0200
@@ -22,10 +22,9 @@
   ]
 
 
+import os
 import urlparse
 
-from soc.logic import system
-
 
 def getSingleIndexedParamValue(request, param_name, values=()):
   """Returns a value indexed by a query parameter in the HTTP request.
@@ -120,7 +119,7 @@
     # no HTTP referrer, so cannot possibly start with expected prefix
     return False
 
-  http_host = 'http://%s/%s' % (system.getHostname(), url_name)
+  http_host = 'http://%s/%s' % (os.environ['HTTP_HOST'], url_name)
 
   if http_from.startswith(http_host):
     return True
--- a/app/soc/views/models/org_app.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/app/soc/views/models/org_app.py	Mon Sep 07 20:26:39 2009 +0200
@@ -22,6 +22,8 @@
   ]
 
 
+import os
+
 from django import forms
 from django.utils import simplejson
 
@@ -30,7 +32,6 @@
 from soc.logic import dicts
 from soc.logic import mail_dispatcher
 from soc.logic import models as model_logic
-from soc.logic import system
 from soc.logic.models import program as program_logic
 from soc.logic.models import org_app as org_app_logic
 from soc.views import helper
@@ -238,7 +239,7 @@
         # use the accepted template and subject
         template = params['accepted_mail_template']
         context['subject'] = 'Congratulations!'
-        context['HTTP_host'] = 'http://%s' % (system.getHostname())
+        context['HTTP_host'] = 'http://%s' % (os.environ['HTTP_HOST'])
       elif status == 'rejected':
         # use the rejected template and subject
         template = params['rejected_mail_template']
--- a/app/soc/views/models/program.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/app/soc/views/models/program.py	Mon Sep 07 20:26:39 2009 +0200
@@ -25,6 +25,8 @@
   ]
 
 
+import os
+
 from django import forms
 from django import http
 from django.utils.translation import ugettext
@@ -32,7 +34,6 @@
 from soc.logic import allocations
 from soc.logic import cleaning
 from soc.logic import dicts
-from soc.logic import system
 from soc.logic.helper import timeline as timeline_helper
 from soc.logic.models import host as host_logic
 from soc.logic.models import mentor as mentor_logic
@@ -415,7 +416,7 @@
     contents = [content]
 
     return_url =  "http://%(host)s%(index)s" % {
-      'host' : system.getHostname(),
+      'host' : os.environ['HTTP_HOST'],
       'index': redirects.getSlotsRedirect(program, params)
       }
 
--- a/scripts/interactive.py	Mon Sep 07 20:07:58 2009 +0200
+++ b/scripts/interactive.py	Mon Sep 07 20:26:39 2009 +0200
@@ -97,8 +97,6 @@
     context: locals that should be added to the shell
   """
 
-  from google.appengine.api import apiproxy_stub_map
-  from google.appengine.api.memcache import memcache_stub
   from google.appengine.ext import db
   from google.appengine.ext.remote_api import remote_api_stub
 
@@ -113,8 +111,6 @@
     host = '%s.appspot.com' % app_id
 
   remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host)
-  apiproxy_stub_map.apiproxy.RegisterStub('memcache',
-      memcache_stub.MemcacheServiceStub())
 
   context['deepFetch'] = deepFetch