Skip to content

Commit

Permalink
Popit instance slug is now a 18 character hash
Browse files Browse the repository at this point in the history
  • Loading branch information
maugsbur committed Oct 16, 2013
1 parent de1cf32 commit d8eeddb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion elections/models.py
Expand Up @@ -60,7 +60,8 @@ def automatically_create_election(sender, instance, created, **kwargs):
)

if getattr(settings, 'USE_POPIT', True):
popit_api_instance_url = settings.POPIT_API_URL% ( election.slug)
short_slug = hex(hash(election.slug))
popit_api_instance_url = settings.POPIT_API_URL% ( short_slug)

popit_api_instance = PopitApiInstance.objects.create(
url = popit_api_instance_url
Expand Down
4 changes: 3 additions & 1 deletion elections/tests/candideitorg_popit_tests.py
Expand Up @@ -141,7 +141,9 @@ def test_it_creates_a_popit_API_client(self):

api_instance = can_election.election.popit_api_instance

expected_url = settings.POPIT_API_URL % ( can_election.election.slug )
short_slug = hex(hash(can_election.election.slug))

expected_url = settings.POPIT_API_URL % ( short_slug )
self.assertEquals(api_instance.url, expected_url)


Expand Down

0 comments on commit d8eeddb

Please sign in to comment.