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


Python CordSubscriber.get_tenant_objects方法代码示例

本文整理汇总了Python中core.xoslib.objects.cordsubscriber.CordSubscriber.get_tenant_objects方法的典型用法代码示例。如果您正苦于以下问题:Python CordSubscriber.get_tenant_objects方法的具体用法?Python CordSubscriber.get_tenant_objects怎么用?Python CordSubscriber.get_tenant_objects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.xoslib.objects.cordsubscriber.CordSubscriber的用法示例。


在下文中一共展示了CordSubscriber.get_tenant_objects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
    def get(self, request, format=None):
        instances=[]
        for subscriber in CordSubscriber.get_tenant_objects().all():
            for user in subscriber.users:
                instances.append( serialize_user(subscriber, user) )

        return Response(instances)
开发者ID:albertoflorez,项目名称:xos,代码行数:9,代码来源:cordsubscriber.py

示例2: ssiddetail

# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
    def ssiddetail(self, pk=None, ssid=None):
        object_list = CordSubscriber.get_tenant_objects().all()

        ssidmap = [ {"service_specific_id": x.service_specific_id, "subscriber_id": x.id} for x in object_list if str(x.service_specific_id)==str(ssid) ]

        if len(ssidmap)==0:
            raise XOSNotFound("didn't find ssid %s" % str(ssid))

        return Response( ssidmap[0] )
开发者ID:albertoflorez,项目名称:xos,代码行数:11,代码来源:cordsubscriber.py

示例3: post

# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
    def post(self, request, format=None):
        data = request.DATA
        subscriber = CordSubscriber.get_tenant_objects().get(id=int(data["subscriber"]))
        user = subscriber.create_user(name=data["name"],
                                    level=data["level"],
                                    mac=data["mac"])
        subscriber.save()

        return Response(serialize_user(subscriber,user))
开发者ID:albertoflorez,项目名称:xos,代码行数:11,代码来源:cordsubscriber.py

示例4: put

# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
    def put(self, request, pk):
        kwargs={}
        if "name" in request.DATA:
             kwargs["name"] = request.DATA["name"]
        if "level" in request.DATA:
             kwargs["level"] = request.DATA["level"]
        if "mac" in request.DATA:
             kwargs["mac"] = request.DATA["mac"]

        parts = pk.split("-")
        subscriber = CordSubscriber.get_tenant_objects().get(id=int(parts[0]))
        user = subscriber.update_user(parts[1], **kwargs)
        subscriber.save()
        return Response(serialize_user(subscriber,user))
开发者ID:albertoflorez,项目名称:xos,代码行数:16,代码来源:cordsubscriber.py

示例5: initdemo

# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
    def initdemo(self, request):
        object_list = CordSubscriber.get_tenant_objects().all()

        # reset the parental controls in any existing demo vCPEs
        for o in object_list:
            if str(o.service_specific_id) in ["0", "1"]:
                self.setup_demo_subscriber(o)

        demo_subscribers = [o for o in object_list if o.is_demo_user]

        if demo_subscribers:
            return Response({"id": demo_subscribers[0].id})

        subscriber = CordSubscriberRoot(service_specific_id=1234,
                                        name="demo-subscriber",)
        subscriber.is_demo_user = True
        subscriber.save()

        self.setup_demo_subscriber(subscriber)

        return Response({"id": subscriber.id})
开发者ID:albertoflorez,项目名称:xos,代码行数:23,代码来源:cordsubscriber.py

示例6: ssidlist

# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
    def ssidlist(self, request):
        object_list = CordSubscriber.get_tenant_objects().all()

        ssidmap = [ {"service_specific_id": x.service_specific_id, "subscriber_id": x.id} for x in object_list ]

        return Response({"ssidmap": ssidmap})
开发者ID:albertoflorez,项目名称:xos,代码行数:8,代码来源:cordsubscriber.py

示例7: delete

# 需要导入模块: from core.xoslib.objects.cordsubscriber import CordSubscriber [as 别名]
# 或者: from core.xoslib.objects.cordsubscriber.CordSubscriber import get_tenant_objects [as 别名]
 def delete(self, request, pk):
     parts = pk.split("-")
     subscriber = CordSubscriber.get_tenant_objects().get(id=int(parts[0]))
     subscriber.delete_user(parts[1])
     subscriber.save()
     return Response("okay")
开发者ID:albertoflorez,项目名称:xos,代码行数:8,代码来源:cordsubscriber.py


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