本文整理汇总了Python中models.account.Account.email方法的典型用法代码示例。如果您正苦于以下问题:Python Account.email方法的具体用法?Python Account.email怎么用?Python Account.email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.account.Account
的用法示例。
在下文中一共展示了Account.email方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: install_account_data
# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import email [as 别名]
def install_account_data():
"""Create all the required accounts if not defined"""
from application import db
from models.account import Account, Group
accountList = [
{
'alias': 'timur.glushan',
'first_name': 'Timur',
'last_name': 'Glushan',
'email': '[email protected]',
'info': None,
'group': Group.query.filter_by(alias='administrator').first()
}
]
for accountItem in accountList:
account = Account.query.filter_by(alias=accountItem['alias']).first()
if not account:
account = Account()
account.alias = accountItem['alias']
account.first_name = accountItem['first_name']
account.last_name = accountItem['last_name']
account.email = accountItem['email']
account.info = accountItem['info']
account.group = accountItem['group']
account.save()
示例2: install_migration_accounts
# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import email [as 别名]
def install_migration_accounts():
"""Migrate the accounts data from the old CouchDB storage"""
from models.account import Account, Group
defaultGroup = Group.query.filter_by(alias=Group.GROUP_DEFAULT).first()
for row in __couchdb().view('_design/employees/_view/employees_list'):
value = row['value']
account = Account.query.filter_by(alias=value.get('_id', '')).first()
if not account:
account = Account()
account.alias = value.get('_id', '')
account.email = value.get('email')
account.first_name = value.get('first_name')
account.last_name = value.get('last_name')
account.stored_password = account.password = value.get('password', None)
if value.get('deleted', False):
account.status = Account.STATUS_ACTIVE | Account.STATUS_DELETED
account.group_id = defaultGroup.id
account.save()
print '[MIGRATION:ACCOUNT]', account.__str__()
示例3: profile_edit
# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import email [as 别名]
def profile_edit(account_id=None):
from models.account import Account, Group
from helpers.account import AccountHelper
account = None
if not account_id:
if not app.access('profile', action='create'):
abort(403)
account = Account()
account.status = Account.STATUS_ACTIVE
account.group_id = Group.query.filter_by(alias=Group.GROUP_DEFAULT).first().id
else:
account_id = urllib.unquote_plus(account_id)
account = Account.query.filter_by(id=account_id).first()
if not account:
abort(404)
elif not app.access('profile', action='update', account=account):
abort(403)
print '[GROUP]',account.group_id, account.group
validationErrors = []
if request.method == 'POST' and request.form.get('csrf_token', None):
account.alias = request.values.get('account_alias', account.alias).strip()
account.first_name = request.values.get('account_first_name', account.first_name).strip()
account.last_name = request.values.get('account_last_name', account.last_name).strip()
account.email = request.values.get('account_email', account.email).strip()
account.info = request.values.get('account_info', account.info).strip()
account_group_id = request.values.get('account_group_id', '').strip()
account.status = int(request.form.get('account_status', account.status).strip())
account_group = None
if account_group_id:
account_group = Group.query.filter_by(id=account_group_id).first()
if not account_group:
account_group = Group.query.filter_by(alias=Group.GROUP_DEFAULT).first()
account.group_id = account_group.id
validationErrors = account.validate()
if not validationErrors:
account.save()
flash(g._t('profile submit success'))
if account_id:
return redirect(url_for('profile_view', account_id=urllib.quote_plus(account_id)))
else:
return redirect(url_for('profile_employees'))
if account_id:
title = g._t('edit profile')
else:
title = g._t('new profile')
if account_id:
breadcrumbs = (
(((not app.access('authenticated', account=account)) and g._t('employees') or ''), url_for('profile_employees')),
((app.access('authenticated', account=account) and g._t('me') or account.__str__()), url_for('profile_view', account_id=account_id)),
(title, "#")
)
else:
breadcrumbs = (
(g._t('employees'), url_for('profile_employees')),
(title, "#")
)
if app.access('profile', action='administer'):
groupList = AccountHelper.listGroups()
else:
groupList = AccountHelper.listActiveGroups()
return render_template('profile/edit.html', account_id=account_id, account=account, groupList=groupList, title=title, breadcrumbs=breadcrumbs, errors=validationErrors)