1. Miki Tebeka
  2. whoops

Commits

Miki Tebeka  committed 78a7d82

delete

  • Participants
  • Parent commits c2e5e8d
  • Branches default

Comments (0)

Files changed (2)

File t

View file
 # conn.append(__file__, remote)
 # print('mkdir')
 # print(conn.mkdir('/tmp/zolo'))
-print('rename')
-print(conn.rename(remote, '/tmp/8z'))
+# print('rename')
+# print(conn.rename(remote, '/tmp/8z'))
+print('delete')
+print(conn.delete('/tmp/8z'))

File webhdfs/__init__.py

View file
 
 octperm = '{:03o}'.format
 intparam = '{:d}'.format
+boolparam = {True: 'true', False: 'false'}.get
 
 
 class WebHDFS(object):
     def put(self, local, path, overwrite=False, blocksize=0, replication=None,
             permission=0, buffersize=0):
 
-        query = {'overwrite': 'true' if overwrite else 'false'}
+        query = {'overwrite': boolparam(overwrite)}
         if blocksize:
             query['blocksize'] = intparam(blocksize)
         if replication:
         query = {'destination': to}
         return self._op('PUT', path, 'RENAME', query)
 
+    @jsonpath(['boolean'])
+    def delete(self, path, recursive=False):
+        query = {'recursive': boolparam(recursive)}
+        return self._op('DELETE', path, 'DELETE', query)
+
+
     # Below here are some utility functions
     def _put(self, op, method, local, path, query):
         if not isfile(local):