Change names to get_upload_dir
and get_upload_url
(#2587)
These shorter names are more concise and easier to type without losing significant information.
This commit is contained in:
parent
47a6901695
commit
b5f06991a9
@ -47,7 +47,7 @@ from reflex.components.core.client_side_routing import (
|
||||
Default404Page,
|
||||
wait_for_client_redirect,
|
||||
)
|
||||
from reflex.components.core.upload import Upload, get_uploaded_files_dir
|
||||
from reflex.components.core.upload import Upload, get_upload_dir
|
||||
from reflex.components.radix import themes
|
||||
from reflex.config import get_config
|
||||
from reflex.event import Event, EventHandler, EventSpec
|
||||
@ -256,7 +256,7 @@ class App(Base):
|
||||
# To access uploaded files.
|
||||
self.api.mount(
|
||||
str(constants.Endpoint.UPLOAD),
|
||||
StaticFiles(directory=get_uploaded_files_dir()),
|
||||
StaticFiles(directory=get_upload_dir()),
|
||||
name="uploaded_files",
|
||||
)
|
||||
|
||||
|
@ -14,7 +14,14 @@ from .responsive import (
|
||||
tablet_and_desktop,
|
||||
tablet_only,
|
||||
)
|
||||
from .upload import Upload, cancel_upload, clear_selected_files, selected_files
|
||||
from .upload import (
|
||||
Upload,
|
||||
cancel_upload,
|
||||
clear_selected_files,
|
||||
get_upload_dir,
|
||||
get_upload_url,
|
||||
selected_files,
|
||||
)
|
||||
|
||||
connection_banner = ConnectionBanner.create
|
||||
connection_modal = ConnectionModal.create
|
||||
|
@ -94,7 +94,7 @@ def cancel_upload(upload_id: str) -> EventSpec:
|
||||
return call_script(f"upload_controllers[{upload_id!r}]?.abort()")
|
||||
|
||||
|
||||
def get_uploaded_files_dir() -> Path:
|
||||
def get_upload_dir() -> Path:
|
||||
"""Get the directory where uploaded files are stored.
|
||||
|
||||
Returns:
|
||||
@ -119,7 +119,7 @@ uploaded_files_url_prefix: Var = Var.create_safe(
|
||||
)
|
||||
|
||||
|
||||
def get_uploaded_file_url(file_path: str) -> str:
|
||||
def get_upload_url(file_path: str) -> str:
|
||||
"""Get the URL of an uploaded file.
|
||||
|
||||
Args:
|
||||
|
@ -29,11 +29,11 @@ def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> BaseVar: ...
|
||||
@CallableEventSpec
|
||||
def clear_selected_files(id_: str = DEFAULT_UPLOAD_ID) -> EventSpec: ...
|
||||
def cancel_upload(upload_id: str) -> EventSpec: ...
|
||||
def get_uploaded_files_dir() -> Path: ...
|
||||
def get_upload_dir() -> Path: ...
|
||||
|
||||
uploaded_files_url_prefix: Var
|
||||
|
||||
def get_uploaded_file_url(file_path: str) -> str: ...
|
||||
def get_upload_url(file_path: str) -> str: ...
|
||||
|
||||
class UploadFilesProvider(Component):
|
||||
@overload
|
||||
|
Loading…
Reference in New Issue
Block a user