當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。