本文整理汇总了Python中db.User.name方法的典型用法代码示例。如果您正苦于以下问题:Python User.name方法的具体用法?Python User.name怎么用?Python User.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db.User
的用法示例。
在下文中一共展示了User.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateUser
# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import name [as 别名]
def updateUser(cookie, uid, handle, name, pwd, admin, email):
session = Session()
u = usermanagment.getUser(cookie)
if not u.admin and uid != u.id:
raise Exception("Invalid access %s %s" % (uid, u.id))
if uid == -1:
cu = User(handle)
session.add(cu)
else:
q = session.query(User).filter_by(id=uid)
if q.count() == 0:
raise Exception("User not found")
cu = q.one()
cu.name = name
cu.email = email
if pwd:
cu.password = pwd
if u.admin:
cu.admin = admin
session.commit()
return cu.id
示例2: Session
# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import name [as 别名]
from db import Session
from db import Person, Job, SeriesJob, Tag, Series, Note, Entity, File, Rating, User
session = Session()
user1 = User()
user1.name="Lisa"
user2 = User()
user2.name="Hanne"
user3 = User()
user3.name="Deindra"
user4 = User()
user4.name="Niklas"
user5 = User()
user5.name="Leander"
user6 = User()
user6.name="Piotr"
user7 = User()
user7.name="Victor"
session.add(user1)
session.add(user2)
session.add(user3)
session.add(user4)
session.add(user5)