@csrf_exempt
@gzip_page
@require_sync_session
@api_handle_error_with_json
def model_download(data, session):
 if ('device_counters' not in data):
  return JsonResponseMessageError('Must provide device counters.', data={'count': 0}, status=400)
 try:
  result = get_serialized_models(data['device_counters'], zone=session.client_device.get_zone(), include_count=True, dest_version=session.client_version)
 except Exception as e:
  print ('Exception downloading models (in api_views): %s, %s, %s' % (e.__class__.__name__, e.message, e.args))
  result = {'error': e.message, 'count': 0}
 session.models_downloaded += result['count']
 session.errors += result.has_key('error')
 return JsonResponse(result)

@ csrf_exempt @ gzip_page @ require_sync_session @ api_handle_error_with_json def model_download ( data , session ) : if ( 'device_counters' not in data ) : return JsonResponseMessageError ( 'Must provide device counters.' , data = { 'count' : 0 } , status = 400 ) try : result = get_serialized_models ( data [ 'device_counters' ] , zone = session . client_device . get_zone ( ) , include_count = True , dest_version = session . client_version ) except Exception as e : print ( 'Exception downloading models (in api_views): %s, %s, %s' % ( e . __class__ . __name__ , e . message , e . args ) ) result = { 'error' : e . message , 'count' : 0 } session . models_downloaded += result [ 'count' ] session . errors += result . has_key ( 'error' ) return JsonResponse ( result )
this device is having its own data downloaded .