Exemplo n.º 1
0
def _massage_stats(request, stats):
    """
    Massage a stats record as returned by the filesystem implementation
    into the format that the views would like it in.
    """
    path = stats['path']
    normalized = Hdfs.normpath(path)
    return {
        'path':
        normalized,
        'name':
        stats['name'],
        'stats':
        stats.to_json_dict(),
        'mtime':
        datetime.datetime.fromtimestamp(
            stats['mtime']).strftime('%B %d, %Y %I:%M %p'),
        'humansize':
        filesizeformat(stats['size']),
        'type':
        filetype(stats['mode']),
        'rwx':
        rwx(stats['mode'], stats['aclBit']),
        'mode':
        stringformat(stats['mode'], "o")
        #'url': make_absolute(request, "view", dict(path=urlquote(normalized))),
        #'is_sentry_managed': request.fs.is_sentry_managed(path)
    }
Exemplo n.º 2
0
Arquivo: views.py Projeto: anutron/hue
def _massage_stats(request, stats):
  """
  Massage a stats record as returned by the filesystem implementation
  into the format that the views would like it in.
  """
  normalized = normpath(stats['path'])
  return {
    'path': normalized,
    'name': posixpath.basename(stats['path']),
    'stats': stats,
    'type': filetype(stats['mode']),
    'rwx': rwx(stats['mode']),
    'url': make_absolute(request, "view", dict(path=urlquote(normalized))),
  }
Exemplo n.º 3
0
def _massage_stats(request, stats):
    """
    Massage a stats record as returned by the filesystem implementation
    into the format that the views would like it in.
    """
    path = stats["path"]
    normalized = Hdfs.normpath(path)
    return {
        "path": normalized,
        "name": posixpath.basename(path),
        "stats": stats.to_json_dict(),
        "type": filetype(stats["mode"]),
        "rwx": rwx(stats["mode"]),
        "url": make_absolute(request, "view", dict(path=urlquote(normalized))),
    }
Exemplo n.º 4
0
def _massage_stats(request, stats):
    """
  Massage a stats record as returned by the filesystem implementation
  into the format that the views would like it in.
  """
    path = stats['path']
    normalized = normpath(path)
    return {
        'path': normalized,
        'name': posixpath.basename(path),
        'stats': stats,
        'type': filetype(stats['mode']),
        'rwx': rwx(stats['mode']),
        'url': make_absolute(request, "view", dict(path=urlquote(normalized))),
    }
Exemplo n.º 5
0
def _massage_stats(request, stats):
    """
    Massage a stats record as returned by the filesystem implementation
    into the format that the views would like it in.
    """
    path = stats['path']
    normalized = Hdfs.normpath(path)
    return {
        'path': normalized,
        'name': stats['name'],
        'stats': stats.to_json_dict(),
        'humansize': filesizeformat(stats['size']),
        'type': filetype(stats['mode']),
        'rwx': rwx(stats['mode']),
        'mode': stringformat(stats['mode'], "o"),
        'url': make_absolute(request, "view", dict(path=urlquote(normalized))),
        }
Exemplo n.º 6
0
def _massage_stats(request, stats):
    """
    Massage a stats record as returned by the filesystem implementation
    into the format that the views would like it in.
    """
    path = stats['path']
    normalized = Hdfs.normpath(path)
    return {
        'path': normalized,
        'name': stats['name'],
        'stats': stats.to_json_dict(),
        'humansize': filesizeformat(stats['size']),
        'type': filetype(stats['mode']),
        'rwx': rwx(stats['mode']),
        'mode': stringformat(stats['mode'], "o"),
        'url': make_absolute(request, "view", dict(path=urlquote(normalized))),
    }
Exemplo n.º 7
0
def _massage_stats(request, stats):
    """
    Massage a stats record as returned by the filesystem implementation
    into the format that the views would like it in.
    """
    path = stats['path']
    normalized = request.fs.normpath(path)
    return {
        'path': normalized,
        'name': stats['name'],
        'stats': stats.to_json_dict(),
        'mtime': datetime.fromtimestamp(stats['mtime']).strftime('%B %d, %Y %I:%M %p'),
        'humansize': filesizeformat(stats['size']),
        'type': filetype(stats['mode']),
        'rwx': rwx(stats['mode'], stats['aclBit']),
        'mode': stringformat(stats['mode'], "o"),
        'url': make_absolute(request, "view", dict(path=normalized)),
        'is_sentry_managed': request.fs.is_sentry_managed(path)
    }