From bb9781a73876663e1ae8bb3f1a2b6dd6a5635cee Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Sun, 12 Sep 2010 15:47:01 -0700
Subject: [PATCH] fixed utf-8 issue in twitter share parameters, continued work
 on fabric deployment file

---
 fabfile.py      | 16 +++++++++++++++-
 helios/views.py |  8 ++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/fabfile.py b/fabfile.py
index 6d5c330..01c14d9 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -45,6 +45,14 @@ def checkout_tag(tag, path):
         if result.failed:
             abort("on remote: could not check out tag %s" % tag)
 
+        result = run('git submodule init')
+        if result.failed:
+            abort("on remote: could not init submodules")
+
+        result = run('git submodule update')
+        if result.failed:
+            abort("on remote: could not update submodules")
+
 def migrate_db(path):
     with cd(path):
         result = run('python manage.py migrate')
@@ -56,12 +64,17 @@ def restart_apache():
     if result.failed:
         abort("could not restart apache")
 
+def restart_celeryd():
+    result = sudo('/etc/init.d/celeryd restart')
+    if result.failed:
+        abort("could not restart celeryd")
+
 def deploy(tag, path):
     confirm("Ready to deploy %s to %s?" % (tag,path))
     run_tests()
     check_tag(tag, path=path)
     checkout_tag(tag, path=path)
-    #migrate_db(path=path)
+    migrate_db(path=path)
     restart_apache()
     
 def staging_deploy(tag):
@@ -69,3 +82,4 @@ def staging_deploy(tag):
 
 def production_deploy(tag):
     deploy(tag, path=PRODUCTION_DIR)
+    restart_celeryd()
diff --git a/helios/views.py b/helios/views.py
index 004a7ed..c94871d 100644
--- a/helios/views.py
+++ b/helios/views.py
@@ -221,13 +221,13 @@ def one_election_view(request, election):
   # status update message?
   if election.openreg:
     if election.voting_has_started:
-      status_update_message = "Vote in %s" % election.name
+      status_update_message = u"Vote in %s" % election.name
     else:
-      status_update_message = "Register to vote in %s" % election.name
+      status_update_message = u"Register to vote in %s" % election.name
 
   # result!
   if election.result:
-    status_update_message = "Results are in for %s" % election.name
+    status_update_message = u"Results are in for %s" % election.name
   
   # a URL for the social buttons
   socialbuttons_url = None
@@ -236,7 +236,7 @@ def one_election_view(request, election):
                                      reverse(socialbuttons),
                                      urllib.urlencode({
           'url' : election_url,
-          'text': status_update_message
+          'text': status_update_message.encode('utf-8')
           }))
 
   trustees = Trustee.get_by_election(election)
-- 
GitLab