本文整理汇总了Python中tracim.lib.user.UserApi.execute_created_user_actions方法的典型用法代码示例。如果您正苦于以下问题:Python UserApi.execute_created_user_actions方法的具体用法?Python UserApi.execute_created_user_actions怎么用?Python UserApi.execute_created_user_actions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim.lib.user.UserApi
的用法示例。
在下文中一共展示了UserApi.execute_created_user_actions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insert
# 需要导入模块: from tracim.lib.user import UserApi [as 别名]
# 或者: from tracim.lib.user.UserApi import execute_created_user_actions [as 别名]
def insert(self):
u = model.User()
u.display_name = 'Global manager'
u.email = '[email protected]'
u.password = '[email protected]'
self._session.add(u)
uapi = UserApi(u)
uapi.execute_created_user_actions(u)
g1 = model.Group()
g1.group_id = 1
g1.group_name = 'users'
g1.display_name = 'Users'
g1.users.append(u)
self._session.add(g1)
g2 = model.Group()
g2.group_id = 2
g2.group_name = 'managers'
g2.display_name = 'Global Managers'
g2.users.append(u)
self._session.add(g2)
g3 = model.Group()
g3.group_id = 3
g3.group_name = 'administrators'
g3.display_name = 'Administrators'
g3.users.append(u)
self._session.add(g3)
示例2: _create_user
# 需要导入模块: from tracim.lib.user import UserApi [as 别名]
# 或者: from tracim.lib.user.UserApi import execute_created_user_actions [as 别名]
def _create_user(self, login, password, **kwargs):
if not password:
if self._password_required():
raise CommandAbortedError("You must provide -p/--password parameter")
password = ''
try:
user = User(email=login, password=password, **kwargs)
self._session.add(user)
self._session.flush()
# We need to enable radicale if it not already done
daemons = DaemonsManager()
daemons.run('radicale', RadicaleDaemon)
user_api = UserApi(user)
user_api.execute_created_user_actions(user)
except IntegrityError:
self._session.rollback()
raise AlreadyExistError()
return user