def semi_get_individual_donations(self, req): isAdmin, s = tools.checkAuthentication(self, False, from_endpoints=True) query = "individual_key:" + str(req.individual_key) results = s.search.donation(query, query_cursor=req.query_cursor) logging.info("Getting individual donations with query: " + query) donations = [] new_cursor = tools.getWebsafeCursor(results[1]) for d in results[0]: f = d.fields team_name = f[6].value if team_name == None: team_name = "" donation = Donation_Data(key=f[0].value, formatted_donation_date=f[9].value, name=f[2].value, email=tools.truncateEmail(f[3].value), payment_type=f[5].value, amount_donated=tools.moneyAmount(f[4].value), team_name=team_name) donations.append(donation) return Donations_Out(objects=donations, new_cursor=new_cursor)
def get_contacts(self, req): isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True) if req.query == None: req.query = "" results = s.search.contact(req.query, query_cursor=req.query_cursor) logging.info("Getting contacts with query: " + req.query) contacts = [] new_cursor = tools.getWebsafeCursor(results[1]) for c in results[0]: f = c.fields contact = Contact_Data(key=f[0].value, name=f[1].value, email=tools.truncateEmail(f[2].value)) contacts.append(contact) return Contacts_Out(objects=contacts, new_cursor=new_cursor)
def email_formatted(self): return tools.truncateEmail(self.email, is_list=True)