本文整理汇总了Python中models.Person.buildPerson方法的典型用法代码示例。如果您正苦于以下问题:Python Person.buildPerson方法的具体用法?Python Person.buildPerson怎么用?Python Person.buildPerson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Person
的用法示例。
在下文中一共展示了Person.buildPerson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: putResult
# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import buildPerson [as 别名]
def putResult(d):
if 'rcsid' not in d:
return
key = d['rcsid']
prev_person = Person.get_by_id(key)
if prev_person:
logging.info("Updating %s", key)
prev_person.update(d)
prev_person.put()
search.Index(name=_INDEX_NAME).put(createDocument(prev_person))
else:
logging.info("New %s", key)
person = Person.buildPerson(d)
person.put()
search.Index(name=_INDEX_NAME).put(createDocument(person))
示例2: putResult
# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import buildPerson [as 别名]
def putResult(d):
"""
person = Person.buildPerson(d)
#if person.department:
#DepartmentKeyword.buildKeywords(person.department)
person.put()
"""
person = Person.buildPerson(d)
conn = rdbms.connect(instance=_INSTANCE_NAME, database="rpidirectory")
cursor = conn.cursor()
query = 'REPLACE INTO rpidirectory (`name`, `campus_mailstop`, `department`, `email`, `fax`, `first_name`, `homepage`, `last_name`, `mailing_address`, `major`, `office_location`, `phone`, `rcsid`, `title`, `year`, `directory_id`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'
args = (person.rcsid, person.campus_mailstop, person.department, person.email, person.fax, person.first_name, person.homepage, person.last_name, person.mailing_address, person.major, person.office_location, person.phone, person.rcsid, person.title, person.year, str(person.directory_id))
logging.info(query)
logging.info(repr(args))
cursor.execute(query, args)
conn.close()
示例3: putResult
# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import buildPerson [as 别名]
def putResult(d):
person = Person.buildPerson(d)
#if person.department:
#DepartmentKeyword.buildKeywords(person.department)
person.put()
search.Index(name=_INDEX_NAME).add(createDocument(person))