本文整理汇总了Python中models.ProfileForm.check_initialized方法的典型用法代码示例。如果您正苦于以下问题:Python ProfileForm.check_initialized方法的具体用法?Python ProfileForm.check_initialized怎么用?Python ProfileForm.check_initialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.ProfileForm
的用法示例。
在下文中一共展示了ProfileForm.check_initialized方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例2: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
# https://cloud.google.com/appengine/docs/python/tools/protorpc/messages/messageclass#all_fields
for field in pf.all_fields():
if hasattr(prof, field.name):
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例3: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例4: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例5: toProfileForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def toProfileForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == "teeShirtSize":
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例6: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
logging.debug("Did run _copyProfileToForm()")
return pf
开发者ID:GoogleCloudPlatformTraining,项目名称:cpd200-conference-central-python,代码行数:16,代码来源:REF_10_conference.py
示例7: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name) and not field.name == 'conferenceKeysToAttend':
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例8: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
elif field.name == 'sessionWishlist':
setattr(pf, field.name, [k.urlsafe() for k in getattr(prof, field.name)])
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例9: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
print pf
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
# getattr(object, name[, default]):Return the value of the named attr. or default
# setattr(object, name, value)
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例10: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
elif (field.name == 'sessionKeysToAttend' or field.name == 'conferenceKeysToAttend'):
new_list = [item.get().key.urlsafe() for item in getattr(prof, field.name)]
setattr(pf, field.name, new_list)
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例11: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, profile):
"""Copy relevant fields from Profile to ProfileForm."""
profileForm = ProfileForm()
for field in profileForm.all_fields():
if hasattr(profile, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr( profileForm,
field.name,
getattr(TeeShirtSize, getattr(profile, field.name)) )
else:
setattr( profileForm,
field.name,
getattr(profile, field.name) )
profileForm.check_initialized()
return profileForm
示例12: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == "teeShirtSize":
setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
if field.name == "websafeSessionKeysWishlist":
sessionKeysWishlist = getattr(prof, "sessionKeysWishlist")
websafeSessionKeysWishlist = [k.urlsafe() for k in websafeSessionKeysWishlist]
setattr(pf, field.name, websafeSessionKeysWishlist)
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例13: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert t-shirt string to Enum; just copy others
if field.name == 'teeShirtSize':
setattr(pf, field.name, getattr(
TeeShirtSize, getattr(prof, field.name)))
elif field.name == "sessionKeysWishlist":
all_keys = []
for each_key in prof.sessionKeysWishlist:
all_keys.append(each_key.urlsafe())
setattr(pf, field.name, all_keys)
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf
示例14: _copyProfileToForm
# 需要导入模块: from models import ProfileForm [as 别名]
# 或者: from models.ProfileForm import check_initialized [as 别名]
def _copyProfileToForm(self, prof):
"""Copy relevant fields from Profile to ProfileForm."""
# copy relevant fields from Profile to ProfileForm
pf = ProfileForm()
for field in pf.all_fields():
if hasattr(prof, field.name):
# convert key objects to websafekey, put it back in a list
if field.name.endswith('Attend'):
key_list = [x.urlsafe() for x in getattr(prof, field.name)]
setattr(pf, field.name, key_list)
# convert t-shirt string to Enum;
elif field.name == 'teeShirtSize':
setattr(pf, field.name,
getattr(TeeShirtSize, getattr(prof, field.name)))
# just copy others
else:
setattr(pf, field.name, getattr(prof, field.name))
pf.check_initialized()
return pf