Fix default game fallback in _restore_game_info #264
Merged
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.
Problem
Noticed the following error in the syslog when navigating to the mod update upload page on alpha:
If users have no game assigned to their current session,
_restore_game_info()
tries to default to KSP.However, it assigns the game's
short
instead of theid
to thegame_id
variable, and then the DB throws a type error.The return value hasn't been used in
update.html
, and increate.html
only for setting the default selection I think.Changes
_restore_game_info()
is now changed to properly fallback to KSP (based on the short).The call to
_restore_game_info()
is removed fromupdate()
since it isn't needed, the game is also no longer passed to the template.In
api.update_mod
a query filter has been changed to compare againstmod.game_id
instead ofMod.game_id
. Not sure why this even worked, I guess SQLAlchemy has some special logic for comparing to classes/table columns, and just tests if the columns are of the same type or something.The
game
parameter forcreate.html
has been renamed togames
, since it's a list of games, not a single one.