本文整理汇总了Python中model.User.User.email方法的典型用法代码示例。如果您正苦于以下问题:Python User.email方法的具体用法?Python User.email怎么用?Python User.email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.User.User
的用法示例。
在下文中一共展示了User.email方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import email [as 别名]
def get(self):
user = users.get_current_user()
#checks to see if we have a user signed in
if user:
userProfile = User.getByEmail(user.email())
#if user profile is empty create one
if not userProfile:
userProfile = User()
userProfile.email = user.email()
userProfile.nickname = 'Anonymous'
userProfile.score = 0
userProfile.played = 0
userProfile.put()
template_values = {
'user': userProfile
}
template = jinja_environment.get_template('profile.html')
self.response.out.write(template.render(template_values))
#if not is ask them to sign in
else:
template_values = {
'signinurl' : users.create_login_url("/")
}
template = jinja_environment.get_template('signin.html')
self.response.out.write(template.render(template_values))
示例2: test_db
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import email [as 别名]
def test_db():
# INSERT
if not session.query(exists().where(User.email == '[email protected]')).scalar():
u1 = User()
u1.name = "Test user"
u1.email = "[email protected]"
a1 = Address()
a1.street = "Str 123"
a1.city = "City WTF"
u1.address = a1
session.add(a1)
session.add(u1)
session.commit()
# check if record exists in db:
# print session.query(Address).filter_by(city='City WTF').count()
# print bool( session.query(Address).filter_by(city='City WTF').count() )
# SELECT
if session.query(exists().where(Address.city == 'City WTF')).scalar():
a2 = session.query(Address).filter_by(city='City WTF').first()
print a2.city
if bool(session.query(Address).filter_by(city='City WTF').count()):
a2 = session.query(Address).filter_by(city='City WTF').first()
print a2.city
# UPDATE
if session.query(exists().where(User.email == '[email protected]')).scalar():
session.query(User).filter_by(email='[email protected]').update({"nick": "a"})
session.commit()
if session.query(exists().where(User.email == '[email protected]')).scalar():
u = session.query(User).filter_by(email='[email protected]').first()
u.nick = "b"
session.commit()
# DELETE
if session.query(exists().where(User.email == '[email protected]')).scalar():
session.query(User).filter_by(email='[email protected]').delete()
session.commit()
if session.query(exists().where(Address.city == 'City WTF')).scalar():
session.query(Address).filter_by(city='City WTF').delete()
session.commit()
示例3: addUser
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import email [as 别名]
def addUser(self, name, fullName, password, email = None, url = None):
"""Create a User
@param name: user's name
@param fullName: user's full name
@param password: user's password
@param email: user's email (default value is set by Confluence)
@param url: user's URL on Confluence (default value is set by Confluence)
@return: User"""
user = User(name, fullName)
user.email = email
user.url = url
try:
result = self.server.addUser(self.token, user.toDict(), password)
return user.toDict()
except Exception, ex:
self.logger.log(str(ex))
raise Exception( 'Unable to add user with the given name %(name)s, full name %(fullName)s, Reason %(errorMessage)s' %{'name' : name, 'fullName' : fullName, 'errorMessage' : Utils.extractDetails(ex)})