本文整理汇总了Python中models.ConferenceForm.check_initialized方法的典型用法代码示例。如果您正苦于以下问题:Python ConferenceForm.check_initialized方法的具体用法?Python ConferenceForm.check_initialized怎么用?Python ConferenceForm.check_initialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.ConferenceForm
的用法示例。
在下文中一共展示了ConferenceForm.check_initialized方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _copyConferenceToForm
# 需要导入模块: from models import ConferenceForm [as 别名]
# 或者: from models.ConferenceForm import check_initialized [as 别名]
def _copyConferenceToForm(self, conf, displayName):
"""Copy relevant fields from Conference to ConferenceForm."""
cf = ConferenceForm()
for field in cf.all_fields():
if hasattr(conf, field.name):
# convert Date to date string; just copy others
if field.name.endswith('Date'):
setattr(cf, field.name, str(getattr(conf, field.name)))
else:
setattr(cf, field.name, getattr(conf, field.name))
elif field.name == "websafeKey":
setattr(cf, field.name, conf.key.urlsafe())
if displayName:
setattr(cf, 'organizerDisplayName', displayName)
cf.check_initialized()
return cf
示例2: _copyConferenceToForm
# 需要导入模块: from models import ConferenceForm [as 别名]
# 或者: from models.ConferenceForm import check_initialized [as 别名]
def _copyConferenceToForm(self, conf, displayName):
"""Copy relevant fields from Conference to ConferenceForm.
Args: conf: conference entity
displayName: Name of conference
Returns: Conference Form
"""
# Establish empty conference form
cf = ConferenceForm()
# For every field in the form
for field in cf.all_fields():
# If the Conference entitry has the field name as a property
if hasattr(conf, field.name):
# convert Date to date string; just copy others
if field.name.endswith('Date'):
setattr(cf, field.name, str(getattr(conf, field.name)))
else:
# Assign the form field to the value in the entity property
setattr(cf, field.name, getattr(conf, field.name))
# Special handling for the websafeKey field
elif field.name == "websafeKey":
# Assign the field from the conference key
setattr(cf, field.name, conf.key.urlsafe())
# Assign the displayName to the form from the function arg if exists
if displayName:
setattr(cf, 'organizerDisplayName', displayName)
# Check that all required fields are present
cf.check_initialized()
return cf
示例3: _copyConferenceToForm
# 需要导入模块: from models import ConferenceForm [as 别名]
# 或者: from models.ConferenceForm import check_initialized [as 别名]
def _copyConferenceToForm(self, conf, displayName):
cf = ConferenceForm()
for field in cf.all_fields():
if hasattr(conf, field.name):
if(field.name.startsWith("Date")):
setattr(cf, field.name, str(getattr(conf, field.name)))
else:
setattr(cf, field.name, getattr(conf, field.name))
elif field.name == "websafeKey":
setattr(cf, field.name, conf.key.urlsafe())
if displayName:
setattr(cf, 'organizerDisplayName', displayName)
cf.check_initialized()
return cf
示例4: toConferenceForm
# 需要导入模块: from models import ConferenceForm [as 别名]
# 或者: from models.ConferenceForm import check_initialized [as 别名]
def toConferenceForm(self, conf=None, displayName=None):
"""Copy relevant fields from Conference to ConferenceForm."""
cf = ConferenceForm()
if conf:
for field in cf.all_fields():
if hasattr(conf, field.name):
# convert Date to date string; just copy others
if field.name.endswith("Date"):
setattr(cf, field.name, str(getattr(conf, field.name)))
else:
setattr(cf, field.name, getattr(conf, field.name))
elif field.name == "websafeConferenceKey" and hasattr(conf, "key"):
setattr(cf, field.name, conf.key.urlsafe())
if displayName:
setattr(cf, "organizerDisplayName", displayName)
cf.check_initialized()
return cf
示例5: _copyConferenceToForm
# 需要导入模块: from models import ConferenceForm [as 别名]
# 或者: from models.ConferenceForm import check_initialized [as 别名]
def _copyConferenceToForm(self, conf, displayName):
# create a new ConferenceForm object
cf = ConferenceForm()
for field in cf.all_fields():
if hasattr(conf, field.name):
# convert Date to date string; just copy others
if field.name.endswith('Date'):
# set cf."field.name" equal to string of conf."field.name"
setattr(cf, field.name, str(getattr(conf, field.name)))
else:
# set cf."field.name" equal to conf."field.name"
setattr(cf, field.name, getattr(conf, field.name))
elif field.name == "websafeKey":
setattr(cf, field.name, conf.key.urlsafe())
if displayName:
setattr(cf, 'organizerDisplayName', displayName)
# check if all required fields are initialized
# returns ValidationError if not
cf.check_initialized()
return cf
示例6: _copyConferenceToForm
# 需要导入模块: from models import ConferenceForm [as 别名]
# 或者: from models.ConferenceForm import check_initialized [as 别名]
def _copyConferenceToForm(self, conference, displayName):
"""Copy relevant fields from Conference to ConferenceForm"""
conferenceForm = ConferenceForm()
for field in conferenceForm.all_fields():
logging.debug("field name is: "+field.name)
if hasattr(conference, field.name):
# convert Date to date string: just copy others
if field.name.endswith('Date'):
setattr(conferenceForm, field.name, str(getattr(conference, field.name)))
else:
setattr(conferenceForm, field.name, getattr(conference, field.name))
elif field.name == "webSafeKey":
setattr(conferenceForm, field.name, conference.key.urlsafe())
if displayName:
setattr(conferenceForm, "organizerDisplayName", displayName)
logging.info( "conferenceForm is: " )
logging.info( conferenceForm )
conferenceForm.check_initialized()
return conferenceForm