Exemple #1
0
 def mkcol(self, request, path, *args, **kwargs):
     if self.resource.exists:
         return HttpResponseNotAllowed(self._allowed_methods())
     if not self.resource.get_parent().exists:
         return HttpResponseConflict()
     length = request.META.get('CONTENT_LENGTH', 0)
     if length and int(length) != 0:
         return HttpResponseMediatypeNotSupported()
     if not self.has_access(self.resource, 'write'):
         return self.no_access()
     self.resource.create_collection()
     self.__dict__['resource'] = self.get_resource(
         path=self.resource.get_path())
     return HttpResponseCreated()
Exemple #2
0
 def mkcol(self, request, path, *args, **kwargs):
     """
     Create a new collection (a directory)
     :param request:
     :param path:
     :param args:
     :param kwargs:
     :return:
     """
     if self.resource.exists:
         return HttpResponseNotAllowed(
             list(set(self._allowed_methods()) - set(['MKCOL', 'PUT'])))
     if not self.resource.get_parent().exists:
         return HttpResponseConflict()
     length = request.META.get('CONTENT_LENGTH', 0)
     if length and int(length) != 0:
         return HttpResponseMediatypeNotSupported()
     if not self.has_access(self.resource, 'write'):
         return self.no_access()
     self.resource.create_collection()
     self.__dict__['resource'] = self.get_resource(
         path=self.resource.get_path())
     return HttpResponseCreated()