Fix AttributeError when importing eyepieces from DeepskyLog#529
Open
brickbots wants to merge 1 commit into
Open
Fix AttributeError when importing eyepieces from DeepskyLog#529brickbots wants to merge 1 commit into
brickbots wants to merge 1 commit into
Conversation
The Flask migration (#331) changed the DeepskyLog eyepiece import to call add_eyepiece() on Equipment.eyepieces, which is a plain list with no such method. The first new eyepiece raised AttributeError, surfacing as "Internal Server Error", and nothing was saved since save_equipment() comes after the loop. Restore the pre-migration call on Equipment itself, which also keeps the eyepiece list sorted by focal length. Regression: v2.5.1 -> v2.6.0 (9e96d22) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
|
Seems like this cold use a unit test/integration test. Are these run regularly btw? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Importing equipment from DeepskyLog on the web interface crashes with an "Internal Server Error" as soon as the import contains a new eyepiece. This is a v2.5.1 → v2.6.0 regression introduced by the Flask migration (#331), which changed the eyepiece-add call from
to
Equipment.eyepiecesis a plainList[Eyepiece]with noadd_eyepiecemethod, so the first new eyepiece raisesAttributeError. Sincecfg.save_equipment()comes after the import loop, nothing gets saved — telescopes already collected in the same request are lost too.This PR restores the pre-migration call on
Equipmentitself (equipment.py:87), which appends the eyepiece and keeps the list sorted by focal length. The manual add-eyepiece route was unaffected (it already calls the correct method atserver.py:736).Test plan
ruff check/ruff format --checkpass onserver.pypytest -m smokepasses (5 passed)Equipment.add_eyepieceappends + sorts, and that a plain list has noadd_eyepieceattribute (the crash path)🤖 Generated with Claude Code