Exemplo n.º 1
0
 def process_request(self, request):
     # Iterate over GET or POST data, search for filepicker.io urls
     for key, val in list(request.POST.items()):
         try:
             fp = FilepickerFile(val)
         except ValueError:
             pass
         else:
             if key in request.FILES:
                 request.FILES.setlist(
                     key,
                     request.FILES.getlist(key) + fp.get_file())
             else:
                 request.FILES.setlist(key, fp.get_file())
Exemplo n.º 2
0
 def process_request(self, request):
     #Iterate over GET or POST data, search for filepicker.io urls
     for key, val in list(request.POST.items()):
         try:
             fp = FilepickerFile(val)
         except ValueError:
             pass
         else:
             splits = val.split(",")
             if key in request.FILES:
                 request.FILES.setlist(key,
                     request.FILES.getlist(key) + fp.get_file())
             else:
                 request.FILES.setlist(key, fp.get_file())
Exemplo n.º 3
0
 def to_python(self, data):
     """Takes the url in data and creates a File object"""
     try:
         fpf = FilepickerFile(data)
     except ValueError as e:
         if 'Not a filepicker.io URL' in str(e):
             # Return None for invalid URLs
             return None
         else:
             # Pass the buck
             raise e
     else:
         return fpf.get_file(self.additional_params)
Exemplo n.º 4
0
 def to_python(self, data):
     """Takes the url in data and creates a File object"""
     try:
         fpf = FilepickerFile(data)
     except ValueError as e:
         if 'Not a filepicker.io URL' in str(e):
             # Return None for invalid URLs
             return None
         else:
             # Pass the buck
             raise e
     else:
         return fpf.get_file(self.additional_params)