本文整理汇总了Python中assembl.models.User.subscribe方法的典型用法代码示例。如果您正苦于以下问题:Python User.subscribe方法的具体用法?Python User.subscribe怎么用?Python User.subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assembl.models.User
的用法示例。
在下文中一共展示了User.subscribe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: participant1_user
# 需要导入模块: from assembl.models import User [as 别名]
# 或者: from assembl.models.User import subscribe [as 别名]
def participant1_user(request, test_session, discussion):
from assembl.models import User, UserRole, Role
u = User(name=u"A. Barking Loon", type="user")
test_session.add(u)
r = Role.get_role(test_session, R_PARTICIPANT)
ur = UserRole(user=u, role=r)
test_session.add(ur)
u.subscribe(discussion)
test_session.flush()
def fin():
print "finalizer participant1_user"
test_session.delete(u)
test_session.flush()
request.addfinalizer(fin)
return u
示例2: participant1_user
# 需要导入模块: from assembl.models import User [as 别名]
# 或者: from assembl.models.User import subscribe [as 别名]
def participant1_user(request, test_session, discussion):
from assembl.models import User, UserRole, Role, EmailAccount
u = User(name=u"A. Barking Loon", type="user", password="password", verified=True)
email = EmailAccount(email="[email protected]", profile=u, verified=True)
test_session.add(u)
r = Role.get_role(R_PARTICIPANT, test_session)
ur = UserRole(user=u, role=r)
test_session.add(ur)
u.subscribe(discussion)
test_session.flush()
def fin():
print "finalizer participant1_user"
test_session.delete(u)
test_session.flush()
request.addfinalizer(fin)
return u