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


Python cordsubscriber.CordSubscriber类代码示例

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


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

示例1: get

    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,代码行数:7,代码来源:cordsubscriber.py

示例2: ssiddetail

    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,代码行数:9,代码来源:cordsubscriber.py

示例3: post

    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,代码行数:9,代码来源:cordsubscriber.py

示例4: put

    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,代码行数:14,代码来源:cordsubscriber.py

示例5: initdemo

    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,代码行数:21,代码来源:cordsubscriber.py

示例6: ssidlist

    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,代码行数:6,代码来源:cordsubscriber.py

示例7: delete

 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,代码行数:6,代码来源:cordsubscriber.py


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