本文整理汇总了Python中GlobalUtilities.getKey方法的典型用法代码示例。如果您正苦于以下问题:Python GlobalUtilities.getKey方法的具体用法?Python GlobalUtilities.getKey怎么用?Python GlobalUtilities.getKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobalUtilities
的用法示例。
在下文中一共展示了GlobalUtilities.getKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_offline_donation
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def new_offline_donation(self, req):
message = "Offline donation created"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
# Make req variables local
name, email, amount_donated, notes, address, team_key, individual_key, \
add_deposit = req.name, req.email, tools.toDecimal(req.amount_donated), req.notes, \
req.address, req.team_key, req.individual_key, req.add_deposit
# Check for null value in individual field
if individual_key == "none":
individual_key = None
if address:
address = [address.street, address.city, address.state, address.zipcode]
if team_key:
team_key = tools.getKey(team_key)
if individual_key:
individual_key = tools.getKey(individual_key)
s.create.donation(name, email, amount_donated, "offline", address=address, team_key=team_key,
individual_key=individual_key, add_deposit=add_deposit, special_notes=notes)
return SuccessMessage_Out(success=success, message=message)
示例2: public_individual_info
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def public_individual_info(self, req):
i = tools.getKey(req.individual_key).get()
t_key = tools.getKey(req.team_key)
info = i.data.info(t_key)
return IndividualInfo_Out(image_url=info[0], name=info[1], description=info[2],
percentage=info[3], message=info[4])
示例3: contact_delete
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def contact_delete(self, req):
message = "Contact deleted"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
tools.getKey(req.contact_key).delete()
return SuccessMessage_Out(success=success, message=message)
示例4: deleteTeam
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def deleteTeam(self, req):
message = "Team deleted"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
tools.getKey(req.team_key).delete()
return SuccessMessage_Out(success=success, message=message)
示例5: merge_contacts
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def merge_contacts(self, req):
message = "Contacts merged"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
c1 = tools.getKey(req.contact1)
c2 = tools.getKey(req.contact2)
tools.mergeContacts(c1, c2)
return SuccessMessage_Out(success=success, message=message)
示例6: run
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def run(self, mode, file_name, keys):
# Open GCS file for writing
gcs_file_key, gcs_file = tools.newFile("text/csv", file_name)
si = cStringIO.StringIO()
writer = csv.writer(si)
for k in keys:
try:
e = tools.getKey(k).get()
row_data = []
if mode == "contacts":
c = e
row_data.append(c.name)
row_data.append(c.data.donation_total)
row_data.append(c.data.number_donations)
row_data.append(c.phone)
row_data.append(c.address[0])
row_data.append(c.address[1])
row_data.append(c.address[2])
row_data.append(c.address[3])
row_data.append(str(c.creation_date))
for e in c.email:
row_data.append(e)
elif mode == "donations":
d = e
c = d.contact.get()
row_data.append(str(d.donation_date))
row_data.append(d.name)
row_data.append(d.given_email)
row_data.append(str(d.amount_donated))
row_data.append(d.payment_type)
row_data.append(d.designated_team)
row_data.append(d.designated_individual)
row_data.append(str(d.reviewed))
row_data.append(c.phone)
row_data.append(c.address[0])
row_data.append(c.address[1])
row_data.append(c.address[2])
row_data.append(c.address[3])
elif mode == "individuals":
i = e
row_data.append(i.name)
row_data.append(i.email)
row_data.append(i.data.readable_team_names)
row_data.append(str(i.data.donation_total))
row_data.append(str(i.creation_date))
writer.writerow(row_data)
except Exception, e:
logging.error("Failed on key " + k + " because " + str(e))
# Call the garbage handler
gc.collect()
示例7: get_team_donation_total
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def get_team_donation_total(self, req):
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
t = tools.getKey(req.team_key).get()
donation_total = tools.moneyAmount(t.data.donation_total)
return GetTeamDonationTotal_Out(donation_total=donation_total)
示例8: update_contact
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def update_contact(self, req):
message = "Contact has been saved"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
c = tools.getKey(req.contact_key).get()
a = req.address
address = [a.street, a.city, a.state, a.zipcode]
# Check to see if a new email was added and see if it already exists
list_diff = tools.listDiff(c.email, req.email)
if list_diff:
email_exists = s.exists.contact(email=list_diff)[0]
else:
email_exists = False
if email_exists == True:
success = False
message = "Whoops! You entered an email address already in use by another contact."
else:
c.update(req.name, req.email, req.phone, req.notes, address)
return SuccessMessage_Out(success=success, message=message)
示例9: task
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def task(self, isAdmin, s):
contact_key = self.request.get("c")
c = tools.getKey(contact_key).get()
template_variables = {"c": c, "s": s}
self.response.write(
template.render('pages/contact.html', template_variables))
示例10: post
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def post(self):
donation_key = self.request.get("donation_key")
d = tools.getKey(donation_key).get()
logging.info("Retrying confirmation email through task queue for donation: " + donation_key)
d.confirmation.email()
示例11: public_all_teams
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def public_all_teams(self, req):
s = tools.getKey(req.settings_key).get()
all_teams = []
for t in s.data.display_teams:
team = Team_Data(name=t.name, key=t.key.urlsafe())
all_teams.append(team)
return AllTeams_Out(objects=all_teams)
示例12: donation_mark_unreviewed
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def donation_mark_unreviewed(self, req):
message = "Donation marked as unreviewed"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
d = tools.getKey(req.donation_key).get()
d.review.markUnreviewed()
return SuccessMessage_Out(success=success, message=message)
示例13: donation_archive
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def donation_archive(self, req):
message = "Donation archived"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
d = tools.getKey(req.donation_key).get()
d.review.archive()
return SuccessMessage_Out(success=success, message=message)
示例14: new_impression
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def new_impression(self, req):
message = "Impression saved"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
c = tools.getKey(req.contact_key).get()
c.create.impression(req.impression, req.notes)
return SuccessMessage_Out(success=success, message=message)
示例15: update_team
# 需要导入模块: import GlobalUtilities [as 别名]
# 或者: from GlobalUtilities import getKey [as 别名]
def update_team(self, req):
message = "Team has been updated"
success = True
isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True)
t = tools.getKey(req.team_key).get()
t.update(req.name, req.show_team)
return SuccessMessage_Out(success=success, message=message)