def _regs_as_dict(self,registrations):
     ''' Given a list of brains, we return proper dictionaries '''
     voc = self.vocabs
     regs = []
     for brain in registrations:
         reg = {}
         reg['id'] = brain.getId
         reg['url'] = brain.getURL()
         reg['email'] = brain.email
         reg['date'] = DateTime(brain.created).strftime('%Y-%m-%d %H:%M')
         reg['title'] = brain.Title
         reg['type'] = voc['types'].getTerm(brain.Subject[0]).title
         reg['num_attendees'] = brain.num_attendees
         reg['price_est'] = fmtPrice(brain.price_est)
         reg['amount'] = fmtPrice(brain.amount)
         reg['state'] = REVIEW_STATE.get(brain.review_state,brain.review_state)
         regs.append(reg)
     return regs
 def _att_as_dict(self,attendees):
     ''' Given a list of brains, we return proper dictionaries '''
     voc = self.vocabs
     atts = []
     for brain in attendees:
         att = {}
         att['id'] = brain.getId
         att['reg'] = brain.getPath().split('/')[-2]
         att['reg_url'] = '/'.join(brain.getURL().split('/')[:-1])
         att['url'] = brain.getURL()
         att['date'] = DateTime(brain.created).strftime('%Y-%m-%d %H:%M')
         att['fullname'] = brain.Title
         att['type'] = brain.Subject and voc['types'].getTerm(brain.Subject[0]).title or ''
         att['email'] = brain.email
         att['badge_name'] = brain.badge_name or att['fullname']
         att['gender'] = voc['gender'].getTerm(brain.gender).title
         att['t_shirt_size'] = voc['tshirt'].getTerm(brain.t_shirt_size).title
         att['state'] = REVIEW_STATE.get(brain.review_state,brain.review_state)
         atts.append(att)
     return atts
 def _att_as_dict(self,attendees):
     ''' Given a list of brains, we return proper dictionaries '''
     voc = self.vocabs
     atts = []
     for brain in attendees:
         reg_type = raw_type = ''
         if brain.Subject:
             reg_type = brain.Subject[0]
             raw_type = reg_type
             if reg_type == 'speaker_c':
                 reg_type = u'Palestrante'
             elif reg_type == 'organizer':
                 reg_type = u'Organização'
             else:
                 reg_type = u'Participante'
         att = {}
         att['id'] = brain.getId
         att['uid'] = brain.UID
         att['reg'] = brain.getPath().split('/')[-2]
         att['reg_url'] = '/'.join(brain.getURL().split('/')[:-1])
         att['url'] = brain.getURL()
         att['date'] = DateTime(brain.created).strftime('%Y-%m-%d %H:%M')
         att['fullname'] = brain.Title
         att['type'] = reg_type
         att['raw_type'] = raw_type
         att['email'] = brain.email
         att['badge_name'] = brain.badge_name or att['fullname']
         att['gender'] = voc['gender'].getTerm(brain.gender).title
         att['t_shirt_size'] = voc['tshirt'].getTerm(brain.t_shirt_size).title
         att['rev_state'] = REVIEW_STATE.get(brain.review_state,brain.review_state)
         att['organization'] = brain.organization
         att['lat'] = brain.latitude
         att['long'] = brain.longitude
         att['city'] = brain.city
         att['state'] = brain.state
         att['country'] = brain.country
         atts.append(att)
     return atts