本文整理汇总了Python中organization.Organization.get方法的典型用法代码示例。如果您正苦于以下问题:Python Organization.get方法的具体用法?Python Organization.get怎么用?Python Organization.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类organization.Organization
的用法示例。
在下文中一共展示了Organization.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AuthenticatedPost
# 需要导入模块: from organization import Organization [as 别名]
# 或者: from organization.Organization import get [as 别名]
def AuthenticatedPost(self, org, event):
# get and check args
ids = [int(id) for id in self.request.get('ids', '').split(',')]
selected_org = (
Organization.get(self.request.get('org'))
if self.request.get('org') else None
)
status = self.request.get('status')
action = self.request.get('action', None)
if action not in self.BULK_ACTIONS:
self.abort(404)
# get authorised events
if org.is_global_admin:
event_keys = list(event_db.Event.all(keys_only=True))
elif org.is_local_admin:
event_keys = org.incidents
# handle bulk action
fn = self.BULK_ACTIONS[action]
for id in ids:
site = Site.get_by_id(id)
authorised = (
site.event.key() in event_keys
and (selected_org is None or any(
incident_key in event_keys for incident_key in [
incident.key() for incident in org.incidents
])
)
)
if authorised:
fn(self, site, org=selected_org, status=status)
# redirect back to work orders table
self.redirect('/admin-view-work-orders')