本文整理汇总了Python中models.ConferenceForm类的典型用法代码示例。如果您正苦于以下问题:Python ConferenceForm类的具体用法?Python ConferenceForm怎么用?Python ConferenceForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConferenceForm类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _copyConferenceToForm
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
开发者ID:DavidANegrete,项目名称:Conference_Central,代码行数:29,代码来源:conference.py
示例2: _copyConferenceToForm
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
开发者ID:qgreg,项目名称:conferencegqw,代码行数:28,代码来源:conference.py
示例3: _copyConferenceToForm
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
开发者ID:iamparas,项目名称:Conference-Centre,代码行数:14,代码来源:conference.py
示例4: toConferenceForm
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
开发者ID:arizonatribe,项目名称:app-engine-demo,代码行数:17,代码来源:mapper.py
示例5: _copyConferenceToForm
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
开发者ID:niamleeson,项目名称:Conference-Central,代码行数:20,代码来源:conference.py
示例6: _copyConferenceToForm
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
开发者ID:TsubasaK111,项目名称:MeetingMaster,代码行数:21,代码来源:conference.py
注:本文中的models.ConferenceForm类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论