def get(self, request, *args, **kwargs):
     result = True
     try:
         file_id = kwargs.get('file_id')
         temp_file = RedisService.get_object(file_id)
         if temp_file:
             result = temp_file
         else:
             result = FileInfoService.get_file(int(file_id), IssueMongoFile)
     except Exception as ex:
         result = str(ex)
         SimpleLogger.exception(ex)
     return HttpResponse(result, content_type="application/octet-stream")
Beispiel #2
0
 def store_cached_file(cached_file_keys):
     result = ""
     keys = cached_file_keys.split(',')
     for key in keys:
         if key != "":
             temp_file = RedisService.get_object(key)
             if temp_file != None:
                 RedisService.delete_value(key)
                 mongo_id = MongoDBService.save_file(
                     temp_file, IssueMongoFile)
                 file_id = FileInfoService.add_file(0, mongo_id,
                                                    temp_file.name, 1, 0,
                                                    temp_file.size)
                 if file_id != 0:
                     result = result + str(file_id) + ","
     return result