Пример #1
0
 def _depacketize(self, object, form):
     ''' Pulls the packet information from the header and adds it to the 
         object as it is reassembled. 
         
         Returns true if the object is complete and ready for dispatch
     '''
     pdata = form.cleaned_data[REQUEST.HEADER]
     # Packetization code
     if REQUEST.SEQUENCE in form.cleaned_data:
         packet = form.cleaned_data[REQUEST.CONTENT]
         offset = pdata[PACKET.OFFSET]
         is_complete = packetlib.accept(object, offset, packet)
     else:
         is_complete = True
     return is_complete
Пример #2
0
 def _depacketize(self, object, form):
     ''' Pulls the packet information from the header and adds it to the 
         object as it is reassembled. 
         
         Returns true if the object is complete and ready for dispatch
     '''
     pdata = form.cleaned_data[REQUEST.HEADER]
     # Packetization code
     if REQUEST.SEQUENCE in form.cleaned_data:
         packet = form.cleaned_data[REQUEST.CONTENT]
         offset = pdata[PACKET.OFFSET]
         is_complete = packetlib.accept(object, offset, packet)
     else:
         is_complete = True
     return is_complete
Пример #3
0
 def _create(self,data):
     binary = Binary.objects.get_or_create(**data)
     # Save extra data
     total_size = data.get('total_size', None)
     uploaded = data.get('uploaded', False)                                    
     if total_size:
         pass
     if uploaded:
         pass
     binary.save()
     #TODO THis should happen in a queue and signal back to upload if 
     # complete
     eof = packetlib.accept(binary, data.offset, data.bytes)
     # eof should be true once complete
     if eof:
         encounter = Encounter.objects.get(uid='l')
         # mark encounter complete and upload
         dispatch = HttpRequest(encounter.dispatch)
         response = encounter_resource.handler.create(dispatch)
         if response.resp_status == STATUS.SUCCESS:
             encounter.uploaded = True
             encounter.save()
         return response
Пример #4
0
 def _create(self, data):
     binary = Binary.objects.get_or_create(**data)
     # Save extra data
     total_size = data.get('total_size', None)
     uploaded = data.get('uploaded', False)
     if total_size:
         pass
     if uploaded:
         pass
     binary.save()
     #TODO THis should happen in a queue and signal back to upload if
     # complete
     eof = packetlib.accept(binary, data.offset, data.bytes)
     # eof should be true once complete
     if eof:
         encounter = Encounter.objects.get(uid='l')
         # mark encounter complete and upload
         dispatch = HttpRequest(encounter.dispatch)
         response = encounter_resource.handler.create(dispatch)
         if response.resp_status == STATUS.SUCCESS:
             encounter.uploaded = True
             encounter.save()
         return response