'chmod(path, mode, recursive=False)
`mode\' should be an octal integer or string.'

def chmod(self, path, mode, recursive=False):

    path = Hdfs.normpath(path)
    params = self._getparams()
    params['op'] = 'SETPERMISSION'
    params['permission'] = safe_octal(mode)
    if recursive:
        for xpath in self.listdir_recursive(path):
            self._root.put(xpath, params)
    else:
        self._root.put(path, params)
