本文整理汇总了Python中models.Contact.put方法的典型用法代码示例。如果您正苦于以下问题:Python Contact.put方法的具体用法?Python Contact.put怎么用?Python Contact.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Contact
的用法示例。
在下文中一共展示了Contact.put方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_contact
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import put [as 别名]
def add_contact(data, instance_id=""):
if instance_id:
contact = Contact.get_by_id(int(instance_id))
else:
contact = Contact()
if data["name"]:
contact.name = data["name"]
if data["contacts"]:
if contact.contacts:
contact.contacts.append(data["contacts"])
else:
contact.contacts = data["contacts"]
if data["email"]:
contact.email = data["email"]
if data["facebook"]:
contact.facebook = data["facebook"]
if data["twitter"]:
contact.twitter = data["twitter"]
contact.put()
return contact
示例2: create_task
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import put [as 别名]
def create_task():
contact = Contact(
firstName = request.json['firstName'],
lastName = request.json['lastName'],
bday = request.json['bday'],
zodiac = request.json['zodiac']
)
contact.put()
return redirect(url_for('index'))
示例3: post
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import put [as 别名]
def post(self):
form = ContactForm(self)
params = {
'form': form,
}
self.response.write(form.validate())
if form.validate():
contact = Contact(
name=self.request.get('name'),
email=self.request.get('email'),
subject=self.request.get('subject'),
body=self.request.get('body'),
)
contact.put()
self.render_response('contact.html', **params)
示例4: execute
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import put [as 别名]
def execute(self):
contact = None
if self.unique_id:
contact = Contact.get_by_unique_id(self.unique_id)
else:
contact = Contact(
unique_id=guid()
)
contact.user = self.user
contact.name = self.name
contact.phone = self.phone
contact.email = self.email
contact.put()
return contact.unique_id
示例5: execute
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import put [as 别名]
def execute(self):
invite_attendee = None
if self.invite_attendee_id:
invite_attendee = InviteAttendee.get_by_unique_id(self.invite_attendee_id)
else:
invite_attendee = InviteAttendee(
unique_id=guid()
)
invite_attendee.name = self.name
invite_attendee.email = self.email
invite_attendee.phone = self.phone
contact = None
if self.user and self.unique_id:
contact = Contact.get_by_unique_id(
self.unique_id
)
elif self.user:
contact = Contact(
unique_id=guid(),
user=self.user
)
# Here we update the contact with the appropiate Data
if contact:
invite_attendee.contact = contact.key
contact.name = self.name
contact.email = self.email
contact.phone = self.phone
contact.put()
invite = Invite.get_by_unique_id(self.invite_id)
invite_attendee.invite = invite.key
invite_attendee.put()
return invite_attendee.unique_id
示例6: post
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import put [as 别名]
def post(self):
name = self.request.get('name','')
email = self.request.get('email','')
message = self.request.get('message','')
subscribe = self.request.get('subscribe', False)
contact = Contact(name = name,
email = email,
subscribe = utils.string_to_bool(subscribe))
contact.put()
if subscribe:
try:
# campaign monitor
createsend = self.handler.preferences.preferences.get('createsend')
listid = createsend.get('list_id')
CreateSend.api_key = createsend.get('api_key')
subscriber = Subscriber(listid, contact.email)
subscriber.add(listid, contact.email, contact.name, [], True)
except Exception, e:
subj = 'CreateSend Exception'
msg = '%s' %e
logging.warning('%s | %s' %(subj, msg))
utils.service_notification(subj, msg)
示例7: create_contact
# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import put [as 别名]
def create_contact(form, user_key=None, photo_url=None, blob_key=None):
try:
new_address = Address(
street=form.street.data,
city=form.city.data,
state=form.state.data,
)
except:
print("Failed to create new address: {0}".format(sys.exc_info()[0]))
try:
new_contact = Contact(
fname=form.fname.data,
lname=form.lname.data,
address=new_address,
email=form.email.data,
phone=form.phone.data,
user_key=user_key,
photo_url=photo_url,
)
except:
print("Failed to create new contact: {0}".format(sys.exc_info()[0]))
return new_contact.put()