本文整理汇总了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)
示例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] )
示例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))
示例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))
示例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})
示例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})
示例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")