def login(self, session, message='', first_name='', last_name='', email='', zip_code='', original_location=None): original_location = create_valid_user_supplied_redirect_url(original_location, default_url='index') if first_name or last_name or email or zip_code: try: attendee = session.lookup_attendee(first_name.strip(), last_name.strip(), email, zip_code) if not attendee.staffing: message = safe_string( 'You are not signed up as a volunteer. ' '<a href="volunteer?id={}">Click Here</a> to sign up.'.format(attendee.id)) elif not attendee.dept_memberships and not c.AT_THE_CON: message = 'You have not been assigned to any departments; ' \ 'an admin must assign you to a department before you can log in' except Exception: message = 'No attendee matches that name and email address and zip code' if not message: ensure_csrf_token_exists() cherrypy.session['staffer_id'] = attendee.id raise HTTPRedirect(original_location) return { 'message': message, 'first_name': first_name, 'last_name': last_name, 'email': email, 'zip_code': zip_code, 'original_location': original_location }
def html(self): if self.is_html: body = re.split('<body[^>]*>', self.body)[1].split('</body>')[0] return safe_string(body) else: return safe_string(self.body.replace('\n', '<br/>'))
def must_contact(self): dept_chairs = [] for dept in self.depts_where_working: poc_names = ' / '.join(sorted(poc.full_name for poc in dept.pocs)) dept_chairs.append('({}) {}'.format(dept.name, poc_names)) return safe_string('<br/>'.join(sorted(dept_chairs)))