|
@@ -204,7 +204,6 @@ class App(Base):
|
|
description: str = constants.DEFAULT_DESCRIPTION,
|
|
description: str = constants.DEFAULT_DESCRIPTION,
|
|
image=constants.DEFAULT_IMAGE,
|
|
image=constants.DEFAULT_IMAGE,
|
|
on_load: Optional[Union[EventHandler, List[EventHandler]]] = None,
|
|
on_load: Optional[Union[EventHandler, List[EventHandler]]] = None,
|
|
- path: Optional[str] = None,
|
|
|
|
meta: List[Dict] = constants.DEFAULT_META_LIST,
|
|
meta: List[Dict] = constants.DEFAULT_META_LIST,
|
|
script_tags: Optional[List[Component]] = None,
|
|
script_tags: Optional[List[Component]] = None,
|
|
):
|
|
):
|
|
@@ -215,7 +214,6 @@ class App(Base):
|
|
|
|
|
|
Args:
|
|
Args:
|
|
component: The component to display at the page.
|
|
component: The component to display at the page.
|
|
- path: (deprecated) The path to the component.
|
|
|
|
route: The route to display the component at.
|
|
route: The route to display the component at.
|
|
title: The title of the page.
|
|
title: The title of the page.
|
|
description: The description of the page.
|
|
description: The description of the page.
|
|
@@ -223,13 +221,10 @@ class App(Base):
|
|
on_load: The event handler(s) that will be called each time the page load.
|
|
on_load: The event handler(s) that will be called each time the page load.
|
|
meta: The metadata of the page.
|
|
meta: The metadata of the page.
|
|
script_tags: List of script tags to be added to component
|
|
script_tags: List of script tags to be added to component
|
|
- """
|
|
|
|
- if path is not None:
|
|
|
|
- utils.deprecate(
|
|
|
|
- "The `path` argument is deprecated for `add_page`. Use `route` instead."
|
|
|
|
- )
|
|
|
|
- route = path
|
|
|
|
|
|
|
|
|
|
+ Raises:
|
|
|
|
+ TypeError: If an invalid var operation is used.
|
|
|
|
+ """
|
|
# If the route is not set, get it from the callable.
|
|
# If the route is not set, get it from the callable.
|
|
if route is None:
|
|
if route is None:
|
|
assert isinstance(
|
|
assert isinstance(
|
|
@@ -244,7 +239,17 @@ class App(Base):
|
|
self.state.setup_dynamic_args(utils.get_route_args(route))
|
|
self.state.setup_dynamic_args(utils.get_route_args(route))
|
|
|
|
|
|
# Generate the component if it is a callable.
|
|
# Generate the component if it is a callable.
|
|
- component = component if isinstance(component, Component) else component()
|
|
|
|
|
|
+ try:
|
|
|
|
+ component = component if isinstance(component, Component) else component()
|
|
|
|
+ except TypeError as e:
|
|
|
|
+ message = str(e)
|
|
|
|
+ if "BaseVar" in message or "ComputedVar" in message:
|
|
|
|
+ raise TypeError(
|
|
|
|
+ "You may be trying to use an invalid Python function on a state var. "
|
|
|
|
+ "When referencing a var inside your render code, only limited var operations are supported. "
|
|
|
|
+ "See the var operation docs here: https://pynecone.io/docs/state/vars "
|
|
|
|
+ ) from e
|
|
|
|
+ raise e
|
|
|
|
|
|
# Add meta information to the component.
|
|
# Add meta information to the component.
|
|
compiler_utils.add_meta(
|
|
compiler_utils.add_meta(
|