当前位置: 首页>>代码示例>>Python>>正文


Python Organization.get方法代码示例

本文整理汇总了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')
开发者ID:DuaneNClark,项目名称:crisiscleanup,代码行数:37,代码来源:admin_view_work_orders_handler.py


注:本文中的organization.Organization.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。