News for hackers. Stuff that matters.
Re:CHVote: Open-source e-voting system from Switzerland by VMG on Wednesday December 14, 2016 @10:45AM (#13176791)
Re:CHVote: Open-source e-voting system from Switzerland by SanFranManDan on Wednesday December 14, 2016 @12:38PM (#13177889)
How they use the singleton is strange also.

https://github.com/vvk-ehk/evalimine/blob/master/ivote-serve...

> Election().count_questions()

> Election().is_hes()

> for el in Election().get_questions()

> Election().is_voters_list_disabled()

Election is a singleton so they keep reinstantiating it every time they want to use it instead of just doing

> election = Election()

at the module level and having a more idiomatic singleton (module variable are singletons). But a singleton design probably isn't the best approach.

The singleton example isn't that bad of code since it assumes that one server will run one election which is a valid assumption, but reading through this code makes me weary about e-voting. I think this proves that OpenSource doesn't always mean good code. There is little incentive for people outside of Estonia to contribute to the project.

Re:CHVote: Open-source e-voting system from Switzerland by jessaustin on Wednesday December 14, 2016 @11:49AM (#13177379)
Haha; this seems pretty dumb:

  if __name__ == '__main__':
      pass