示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    def get_team_members(self, req):
        isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
        query = "team_key:" + str(req.team_key)

        results = s.search.individual(query, query_cursor=req.query_cursor)
        logging.info("Getting team members with query: " + query)

        individuals = []
        new_cursor = tools.getWebsafeCursor(results[1])

        for i in results[0]:
            f = i.fields

            individual = Individual_Data(key=f[0].value, name=f[1].value, email=f[2].value,
                                         raised=tools.moneyAmount(f[4].value))
            individuals.append(individual)

        return Individuals_Out(objects=individuals, new_cursor=new_cursor)
示例#4
0
    def get_teams(self, req):
        isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)

        if req.query == None:
            req.query = ""

        results = s.search.team(req.query, query_cursor=req.query_cursor)
        logging.info("Getting teams with query: " + req.query)

        teams = []
        new_cursor = tools.getWebsafeCursor(results[1])

        for t in results[0]:
            f = t.fields

            team = Team_Data(key=f[0].value, name=f[1].value, donation_total=tools.moneyAmount(f[2].value))
            teams.append(team)

        return Teams_Out(objects=teams, new_cursor=new_cursor)
示例#5
0
    def get_deposits(self, req):
        isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)

        if req.query == None:
            req.query = ""

        results = s.search.deposit(req.query, query_cursor=req.query_cursor)
        logging.info("Getting deposits with query: " + req.query)

        deposits = []
        new_cursor = tools.getWebsafeCursor(results[1])

        for de in results[0]:
            f = de.fields

            deposit = Deposit_Data(key=f[0].value, time_deposited=f[1].value)
            deposits.append(deposit)

        return Deposits_Out(objects=deposits, new_cursor=new_cursor)