예제 #1
0
파일: person.py 프로젝트: iseppi/zookeepr
    def finish_edit(self, person):
        for key in self.form_result['person']:
            setattr(person, key, self.form_result['person'][key])

        for sn in self.form_result['social_network']:
           network = SocialNetwork.find_by_name(sn['name'])
           if sn['account_name']:
               person.social_networks[network] = sn['account_name']
           elif network in person.social_networks:
               del person.social_networks[network]

        # update the objects with the validated form data
        meta.Session.commit()
예제 #2
0
파일: person.py 프로젝트: iseppi/zookeepr
    def finish_signup(self):
        c.form = 'finish_signup'

        c.person = h.signed_in_person()
        c.social_networks = SocialNetwork.find_all()
        c.person.fetch_social_networks()

        defaults = h.object_to_defaults(c.person, 'person')
        if not defaults['person.country']:
            defaults['person.country'] = 'AUSTRALIA'

        form = render('/person/finish_signup.mako')
        return htmlfill.render(form, defaults)
예제 #3
0
파일: person.py 프로젝트: iseppi/zookeepr
    def edit(self, id):
        # We need to recheck auth in here so we can pass in the id
        if not h.auth.authorized(h.auth.Or(h.auth.is_same_zkpylons_user(id), h.auth.has_organiser_role)):
            # Raise a no_auth error
            h.auth.no_role()
        c.form = 'edit'
        c.person = Person.find_by_id(id)
        c.social_networks = SocialNetwork.find_all()
        c.person.fetch_social_networks()

        defaults = h.object_to_defaults(c.person, 'person')
        if not defaults['person.country']:
            defaults['person.country'] = 'AUSTRALIA'

        form = render('/person/edit.mako')
        return htmlfill.render(form, defaults)
예제 #4
0
파일: person.py 프로젝트: iseppi/zookeepr
    def new(self):
        # Do we allow account creation?
        if Config.get('account_creation'):
            """Create a new person form.
            """
            if h.signed_in_person():
                h.flash("You're already logged in")
                redirect_to('home')

            defaults = {
                'person.country': 'AUSTRALIA',
            }
            if Config.get('personal_info', category='rego')['home_address'] == 'no':
                defaults['person.address1'] = 'not available'
                defaults['person.city'] = 'not available'
                defaults['person.postcode'] = 'not available'

            c.social_networks = SocialNetwork.find_all()

            form = render('/person/new.mako')
            return htmlfill.render(form, defaults)
        else:
            return render('/not_allowed.mako')
예제 #5
0
 def _to_python(self, value, state):
     return SocialNetwork.find_by_id(value)
예제 #6
0
 def _to_python(self, value, state):
     return SocialNetwork.find_by_id(value)