示例#1
0
def browse(request, folder, path, template_name):
    if not FileOperations.valid_file(request.user.username, folder, path):
        raise Http404
    path = path.replace("//", "/")
    path_parts = []
    path_parts_temp = path.split("/")
    path_construct = ""
    for item in path_parts_temp[:-1]:
        path_construct = "%s/%s" % (path_construct, item)
        path_parts.append((path_construct, item))

    ret_dict = {"folder": folder, "path": path, "path_parts": path_parts, "current_path": path_parts_temp[-1] }
    return render_to_response(template_name, ret_dict, context_instance=RequestContext(request))
示例#2
0
def main(request, template_name):
    ret_dict = {"homefolder_exists": True}
    if not FileOperations.valid_file(request.user.username, "public_html", ""):
        ret_dict["homefolder_exists"] = False
    return render_to_response(template_name, ret_dict, context_instance=RequestContext(request))