本文整理汇总了Python中model.Member.member_type方法的典型用法代码示例。如果您正苦于以下问题:Python Member.member_type方法的具体用法?Python Member.member_type怎么用?Python Member.member_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Member
的用法示例。
在下文中一共展示了Member.member_type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import member_type [as 别名]
def get(self):
config = Configuration()
ruler = """
--------------------------------------------------------------------------------
0________1_________2_________3_________4_________5_________6_________7_________8
1 0 0 0 0 0 0 0 0
--------------------------------------------------------------------------------
"""
template = Template(config.get('WELCOME_MAIL_TEXT'))
member = Member()
member.name = 'Ola Normann'
member.address = 'Norskeveien 1'
member.zipcode = '9876'
member.city = 'Olabyen'
member.country = Country().all().order('order').fetch(1)[0]
member.email = '[email protected]'
member.phone = '916 75 105'
member.phone_home = '939 90 115'
member.phone_work = '101 33 116'
member.number = '9669'
member.access_code = 'BBQWTF'
member.member_type = MemberType.all().order('order').fetch(1)[0]
sample_data = {
'year': 2014,
'fee': 400,
'account_no': config.get('GIRO_ACCOUNT_NO'),
'member': member,
'profile_url': constants.PROFILE_URL
}
sample_text = template.render(sample_data)
# Merge template before submitting text
data = {'text': ruler + sample_text + ruler }
template = JINJA_ENVIRONMENT.get_template('templates/settings/email_preview.html')
self.response.write(template.render(data))
示例2: post
# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import member_type [as 别名]
def post(self):
complete = []
incomplete = []
values = {}
# Holy crap this is ugly. There has to be a better way.
name = self.request.get('name')
if not name or name.strip() == '':
incomplete.append('name')
else:
values['name'] = name
complete.append('name')
address = self.request.get('address')
if not address or address.strip() == '':
incomplete.append('address')
else:
values['address'] = address
complete.append('address')
zipcode = self.request.get('zip')
if (not zipcode or zipcode.strip() == '') or len(zipcode.strip()) < 4:
incomplete.append('zip')
else:
values['zip'] = zipcode
complete.append('zip')
city = self.request.get('city')
if not city or city.strip() == '':
incomplete.append('city')
else:
values['city'] = city
complete.append('city')
if 'zip' in incomplete or 'city' in incomplete:
incomplete.append('zipcity')
country_key = self.request.get('country').strip()
country = Country.get(country_key)
countries = Country.all().order('order').fetch(100)
if not country or not country_key or country_key.strip() == '':
incomplete.append('country')
# retrieve countries since we're going to need them
else:
values['country'] = country.name
complete.append('country')
email = self.request.get('email')
if not email or email.strip() == '' or not mail.is_email_valid(email):
incomplete.append('email')
else:
values['email'] = email
complete.append('email')
mobile = self.request.get('mobile')
if mobile and mobile.strip() == '':
mobile = None
values['mobile'] = mobile
home = self.request.get('home')
if home and home.strip() == '':
home = None
values['home'] = home
work = self.request.get('work')
if work and work.strip() == '':
work = None
values['work'] = work
member_type = self.request.get('type')
if not member_type or member_type.strip() == '':
member_type = '1'
types = MemberType.all().fetch(100)
mtype = None
# TODO: Custom settings? Constants at least.
if member_type == '1':
mtype = next(t for t in types if t.name == DEFAULT_MEMBER_NAME)
else:
mtype = next(t for t in types if t.name == DEFAULT_SUPPORT_MEMBER_NAME)
values['type'] = mtype.name
comment = self.request.get('comment')
complete.append('comment')
values['comment'] = comment
error_message = ''
# Check if member exists;
existing = Member.all().filter('email', email).fetch(1)
#.........这里部分代码省略.........