本文整理汇总了Python中focus.models.Actor.convert_gender方法的典型用法代码示例。如果您正苦于以下问题:Python Actor.convert_gender方法的具体用法?Python Actor.convert_gender怎么用?Python Actor.convert_gender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类focus.models.Actor
的用法示例。
在下文中一共展示了Actor.convert_gender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enroll_family_member
# 需要导入模块: from focus.models import Actor [as 别名]
# 或者: from focus.models.Actor import convert_gender [as 别名]
def enroll_family_member(self, user_data):
"""Enroll the given user and add them to this users' family membership.
user_data is a dict with the following keys:
- first_name
- last_name
- dob
- gender
- phone
- email"""
try:
focus_service = suds.client.Client(settings.FOCUS_WSDL_URL)
# Use a kwargs dictionary to avoid SyntaxError with non-ascii unicode characters for parameter names
params = {
'Token': settings.FOCUS_WSDL_TOKEN,
'Hovedmedlem': self.actor.memberid,
'Husstandsnummer': 0,
'Fornavn': user_data['first_name'],
'Etternavn': user_data['last_name'],
'Født': datetime(
year=user_data['dob'].year,
month=user_data['dob'].month,
day=user_data['dob'].day,
),
'Kjonn': Actor.convert_gender(user_data['gender']),
'Mobil': user_data['phone'],
'Epost': user_data['email'],
'Gjensidige': user_data['accepts_partneroffers'],
}
result = focus_service.service.EndreHusstand(**params)
if result != 'OK':
raise Exception("Unknown Focus Webservice result '%s'" % result)
except:
logger.warning(
"Feil med Focus webtjeneste",
exc_info=sys.exc_info(),
extra={
'member': self,
'user_data': user_data,
},
)
raise FocusServiceError