def connector_view(request, coll_id=None): """ Handles requests for the elFinder connector. """ fs_driver_root = "%s/elfinder/%s" % ( elfinder_settings.ELFINDER_FS_DRIVER_ROOT, request.account.user.username) if not os.path.exists(fs_driver_root): os.makedirs(fs_driver_root) volume = FileSystemVolumeDriver(fs_driver_root=fs_driver_root) # volume = get_volume_driver()(collection_id=coll_id) finder = ElFinderConnector([volume]) finder.run(request) # Some commands (e.g. read file) will return a Django View - if it # is set, return it directly instead of building a response if finder.return_view: return finder.return_view response = HttpResponse(mimetype=finder.httpHeader['Content-type']) response.status_code = finder.httpStatusCode if finder.httpHeader['Content-type'] == 'application/json': response.content = json.dumps(finder.httpResponse) else: response.content = finder.httpResponse return response
def connector_view(request, coll_id=None): """ Handles requests for the elFinder connector. """ volume_driver = VolumeDriver(request, json_response=True, collection_id=coll_id) if not volume_driver: # not has access return volume_driver.login_view finder = ElFinderConnector([volume_driver.volume]) try: finder.run(request) except: if settings.ELFINDER_DEBUG: import traceback traceback.print_exc() raise # Some commands (e.g. read file) will return a Django View - if it # is set, return it directly instead of building a response if finder.return_view: return finder.return_view response = HttpResponse(content_type=finder.httpHeader['Content-type']) response.status_code = finder.httpStatusCode if finder.httpHeader['Content-type'] == 'application/json': response.content = json.dumps(finder.httpResponse, cls=DjangoJSONEncoder, ensure_ascii=False) else: response.content = finder.httpResponse return response
def connector_view(request, coll_id=None): """ Handles requests for the elFinder connector. """ fs_driver_root="%s/elfinder/%s" % (elfinder_settings.ELFINDER_FS_DRIVER_ROOT, request.account.user.username) if not os.path.exists(fs_driver_root): os.makedirs(fs_driver_root) volume = FileSystemVolumeDriver(fs_driver_root=fs_driver_root) # volume = get_volume_driver()(collection_id=coll_id) finder = ElFinderConnector([volume]) finder.run(request) # Some commands (e.g. read file) will return a Django View - if it # is set, return it directly instead of building a response if finder.return_view: return finder.return_view response = HttpResponse(mimetype=finder.httpHeader['Content-type']) response.status_code = finder.httpStatusCode if finder.httpHeader['Content-type'] == 'application/json': response.content = json.dumps(finder.httpResponse) else: response.content = finder.httpResponse return response
def connector_view(request, coll_id): """ Handles requests for the elFinder connector. """ model_volume = ModelVolumeDriver(coll_id) finder = ElFinderConnector([model_volume]) finder.run(request) # Some commands (e.g. read file) will return a Django View - if it # is set, return it directly instead of building a response if finder.return_view: return finder.return_view response = HttpResponse(mimetype=finder.httpHeader['Content-type']) response.status_code = finder.httpStatusCode if finder.httpHeader['Content-type'] == 'application/json': response.content = json.dumps(finder.httpResponse) else: response.content = finder.httpResponse return response