tetra-framework / tetra

Tetra - A full stack component framework for Django using Alpine.js
https://www.tetraframework.com
MIT License
569 stars 19 forks source link

BasicComponent fails with "has no attribute 'make_script'" #38

Closed nerdoc closed 8 months ago

nerdoc commented 2 years ago

I'm sorry, here is my daily bug ;-) Don't get me wrong - Tetra is a wonderful piece of software - it's just... I am good in finding bugs.

When I try to use BasicComponent, Django crashes:

...
  File "/home/christian/tmp/foo/.venv/lib/python3.10/site-packages/tetra/build.py", line 9, in build
    lib.build()
  File "/home/christian/tmp/foo/.venv/lib/python3.10/site-packages/tetra/library.py", line 105, in build
    self.build_js(file_cache_path, file_out_path)
  File "/home/christian/tmp/foo/.venv/lib/python3.10/site-packages/tetra/library.py", line 134, in build_js
    main_scripts.append(component.make_script())
AttributeError: type object 'MyComponent' has no attribute 'make_script'. Did you mean: 'has_script'?

when debugging I found: - in library.py L 119, it asks the component.has_script(), and then it crashes in https://github.com/samwillis/tetra/blob/3f8fd3586eddd836983ec73ddad5ecfa3707e785/tetra/library.py#L134 because BasicComponent has no make_script() method, this is only defined in Component... Eh - tests would help here... #32 ... If I knew how you would like to have your tests, I would write some... :-)

nerdoc commented 8 months ago

fixed with https://github.com/tetra-framework/tetra/commit/96677231bf1c07b7da48aa641b1119f2faf8372f