@allow_jsonp
def register_public_key_server_auto(request):
 public_key = urllib.unquote(request.GET.get('device_key', ''))
 if RegisteredDevicePublicKey.objects.filter(public_key=public_key):
  return HttpResponseForbidden('Device is already registered.')
 zone = Zone(name=('Zone for public key %s' % public_key[:50]))
 zone.save()
 RegisteredDevicePublicKey(zone=zone, public_key=public_key).save()
 return JsonResponse({})

@ allow_jsonp def register_public_key_server_auto ( request ) : public_key = urllib . unquote ( request . GET . get ( 'device_key' , '' ) ) if RegisteredDevicePublicKey . objects . filter ( public_key = public_key ) : return HttpResponseForbidden ( 'Device is already registered.' ) zone = Zone ( name = ( 'Zone for public key %s' % public_key [ : 50 ] ) ) zone . save ( ) RegisteredDevicePublicKey ( zone = zone , public_key = public_key ) . save ( ) return JsonResponse ( { } )
this function allows an anonymous client to request a device key to be associated with a new zone .