From c5fb1804a5919787ce5714bb506cbed57c3b292b Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Sun, 30 Jan 2011 19:45:07 -0800
Subject: [PATCH] more json-ld compliant output

---
 helios/datatypes/__init__.py | 2 +-
 helios/tests.py              | 5 +++--
 helios/views.py              | 3 +++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/helios/datatypes/__init__.py b/helios/datatypes/__init__.py
index 0901a33..98b3ad7 100644
--- a/helios/datatypes/__init__.py
+++ b/helios/datatypes/__init__.py
@@ -192,7 +192,7 @@ class LDObject(object):
 
         if self.USE_JSON_LD:
             if complete:
-                val['#'] = {'_': 'http://heliosvoting.org/ns#'}
+                val['#'] = {'#vocab': 'http://heliosvoting.org/ns#'}
 
             if hasattr(self, 'datatype'):
                 val['a'] = self.datatype
diff --git a/helios/tests.py b/helios/tests.py
index 310e549..3d17ab4 100644
--- a/helios/tests.py
+++ b/helios/tests.py
@@ -372,8 +372,9 @@ class ElectionBlackboxTests(TestCase):
         election_id = re.search('/elections/([^/]+)/', str(response['Location'])).group(1)
 
         # add helios as trustee
-        response = self.client.post("/helios/elections/%s/trustees/add-helios" % election_id)
-        self.assertRedirects(response, "/helios/elections/%s/trustees/view" % election_id)
+        # no longer needed because automatic for all elections
+        #response = self.client.post("/helios/elections/%s/trustees/add-helios" % election_id)
+        #self.assertRedirects(response, "/helios/elections/%s/trustees/view" % election_id)
 
         # check that helios is indeed a trustee
         response = self.client.get("/helios/elections/%s/trustees/view" % election_id)
diff --git a/helios/views.py b/helios/views.py
index 6907d29..bddd310 100644
--- a/helios/views.py
+++ b/helios/views.py
@@ -191,6 +191,9 @@ def election_new(request):
         election, created_p = Election.get_or_create(**election_params)
       
         if created_p:
+          # add Helios as a trustee by default
+          election.generate_trustee(ELGAMAL_PARAMS)
+          
           return HttpResponseRedirect(reverse(one_election_view, args=[election.uuid]))
         else:
           error = "An election with short name %s already exists" % election_params['short_name']
-- 
GitLab