Exemplo n.º 1
0
 def new_2(self, name, election_type):
   """
   Enter additional information about the election type.
   """
   user = Controller.user()
   
   eg_params_json = utils.to_json(ELGAMAL_PARAMS.toJSONDict())
   return self.render('new_2')
Exemplo n.º 2
0
    def new_2(self, name, election_type):
        """
    Enter additional information about the election type.
    """
        user = Controller.user()

        eg_params_json = utils.to_json(ELGAMAL_PARAMS.toJSONDict())
        return self.render('new_2')
Exemplo n.º 3
0
  def check(cls, election, allow_frozen=False, require_frozen=False):
    """
    An internal check that the user is allowed to administer this given election.
    Optional parameters check the status of the election.
    """
    user = Controller.user()
    api_client = do.APIClient.get_by_consumer_key(Controller.api_client())
    if user != election.admin and api_client != election.api_client:
      raise cherrypy.HTTPRedirect('/')

    if election.is_frozen() and not allow_frozen:
      raise cherrypy.HTTPError(500, 'This election is frozen and cannot be modified.')

    if not election.is_frozen() and require_frozen:
      raise cherrypy.HTTPError(500, "Election must be frozen before emailing voters.")

    return user, api_client, election
Exemplo n.º 4
0
    def check(cls, election, allow_frozen=False, require_frozen=False):
        """
    An internal check that the user is allowed to administer this given election.
    Optional parameters check the status of the election.
    """
        user = Controller.user()
        api_client = do.APIClient.get_by_consumer_key(Controller.api_client())
        if user != election.admin and api_client != election.api_client:
            raise cherrypy.HTTPRedirect('/')

        if election.is_frozen() and not allow_frozen:
            raise cherrypy.HTTPError(
                500, 'This election is frozen and cannot be modified.')

        if not election.is_frozen() and require_frozen:
            raise cherrypy.HTTPError(
                500, "Election must be frozen before emailing voters.")

        return user, api_client, election