Ejemplo n.º 1
0
    def post(self):
        """Validates the information placed on the form by the user. It also 
        calls the function to create an instance of a Spoogler in the Datastore 
        and displays messages according to what the user has written on the 
        fields of the form (success or failure)"""
        
        token_value = 0
        template_context = {}
        get_spoogler_context(self.request, template_context)
        template_context['confirmation_ldap'] = template_context['googler_ldap']

        # Initialize the template fields that contain multiple options in the form
        init_multiple_options(template_context)

        if FormHandler._validate_form(template_context):
            template_context['valid_form'] = True
            token_value = FormHandler._generate_token()
            
            if self._create_spoogler(template_context, token_value):
                self._send_confirmation_email(template_context['googler_ldap'],
                                              template_context['test'],
                                              token_value, template_context['full_name'])

            FormHandler._clean_context(template_context)

        else:
            template_context['valid_form'] = False
    
        self.response.out.write(FormHandler._render_template('main.html', 
                            template_context))
Ejemplo n.º 2
0
    def post(self):
        """Validates the information placed on the form by the user. It also 
        calls the function to create an instance of a Spoogler in the Datastore 
        and displays messages according to what the user has written on the 
        fields of the form (success or failure)"""

        token_value = 0
        template_context = {}
        get_spoogler_context(self.request, template_context)
        template_context['confirmation_ldap'] = template_context[
            'googler_ldap']

        # Initialize the template fields that contain multiple options in the form
        init_multiple_options(template_context)

        if FormHandler._validate_form(template_context):
            template_context['valid_form'] = True
            token_value = FormHandler._generate_token()

            if self._create_spoogler(template_context, token_value):
                self._send_confirmation_email(template_context['googler_ldap'],
                                              template_context['test'],
                                              token_value,
                                              template_context['full_name'])

            FormHandler._clean_context(template_context)

        else:
            template_context['valid_form'] = False

        self.response.out.write(
            FormHandler._render_template('main.html', template_context))
Ejemplo n.º 3
0
    def get(self):
        """Displays the form for the Spoogler/Googler to fill out."""
        # Initialize default options
        template_context = {}
        get_spoogler_context(self.request, template_context)
        template_context['valid_form'] = True
        template_context['successful_submission'] = False
        template_context['confirmation_ldap'] = ""

        # Initialize the template fields that contain multiple options in the form
        init_multiple_options(template_context)
        self.response.out.write(self._render_template('main.html', 
                                template_context))
Ejemplo n.º 4
0
    def get(self):
        """Displays the form for the Spoogler/Googler to fill out."""
        # Initialize default options
        template_context = {}
        get_spoogler_context(self.request, template_context)
        template_context['valid_form'] = True
        template_context['successful_submission'] = False
        template_context['confirmation_ldap'] = ""

        # Initialize the template fields that contain multiple options in the form
        init_multiple_options(template_context)
        self.response.out.write(
            self._render_template('main.html', template_context))
Ejemplo n.º 5
0
    def get(self):
        """Displays the admin form for the ambassadors/admins."""
        template_context = {}
        get_spoogler_context(self.request, template_context)
        # Find the name of the admin that is logged in
        current_user = template_context['user']
        user_email = current_user.email()
        strip_at_index = user_email.find("@")
        template_context['user_name'] = user_email[0:strip_at_index]

        query = Spoogler.query()
        query = query.order(-Spoogler.date_created).order(Spoogler.full_name)
        template_context['query'] = query
        self.update(template_context)
Ejemplo n.º 6
0
    def post(self):
        # get context
        template_context = {}
        get_spoogler_context(self.request, template_context)

        # Build query
        query = Spoogler.query()
        query = query.order(-Spoogler.date_created).order(Spoogler.full_name)
        #logging.info(template_context['work_status'])

        # Apply filters
        template_context['query'] = self._apply_filters(
            query, template_context)

        self.update(template_context)