TexteaInc / funix

Building web apps without manually creating widgets
http://funix.io
MIT License
89 stars 10 forks source link

Two errors with new dev branch #34

Closed forrestbao closed 1 year ago

forrestbao commented 1 year ago

I am at commit d68bc0189677f79a34185de53e0610274e7243c4 (HEAD -> dev, origin/dev)

Author: Ruixuan Tu <turx2003@gmail.com>
Date:   Thu Aug 18 00:22:06 2022 -0500

    feat: "treat_as" default to be "config", "path" default to be function name
    example: remove Optional, empty decorator

But when I tried to convert examples/examples.py, I ran into two errors:

  File "/home/forrest/Textea/PyDataFront/examples/examples.py", line 116, in <module>
    def calc_literal(a: List[int], b: List[int], op: Literal["add", "minus"]) -> calc_return:
  File "/home/forrest/Textea/PyDataFront/backend/pydatafront/decorator/__init__.py", line 173, in decorator
    decorated_params[function_arg_name].update(function_arg_type_dict)
TypeError: 'NoneType' object is not iterable
    def calc_add(a: List[int], b: List[int]) -> calc_return:
  File "/home/forrest/Textea/PyDataFront/backend/pydatafront/decorator/__init__.py", line 222, in decorator
    get_wrapper(decorated_function_param_getter)
  File "/home/forrest/.local/lib/python3.10/site-packages/flask/scaffold.py", line 440, in decorator
    self.add_url_rule(rule, endpoint, f, **options)
  File "/home/forrest/.local/lib/python3.10/site-packages/flask/scaffold.py", line 56, in wrapper_func
    return f(self, *args, **kwargs)
  File "/home/forrest/.local/lib/python3.10/site-packages/flask/app.py", line 1090, in add_url_rule
    raise AssertionError(
AssertionError: View function mapping is overwriting an existing endpoint function: calc_add_param_getter

I am not sure whether this is due to that the example functions have not be refactored to be compatible with the latest PyDataFront decorator in the dev branch.

TURX commented 1 year ago

You might run into merge conflict or another type of conflict with two functions with the same path.

I could run the backend with dev examples. A screenshot is attached below.

image

forrestbao commented 1 year ago

Fixed in https://github.com/TexteaInc/PyDataFront/commit/e1b535c66ff37de77c7972db449ab868a4d7906c