major-domo-database/app
Cal Corum 6d36704f35
Some checks failed
Build Docker Image / build (pull_request) Has been cancelled
fix: Prevent locals() from polluting player PATCH data dict
CRITICAL BUG FIX - Root cause of Player.data AttributeError

Problem:
The PATCH endpoint was calling locals() AFTER creating data = {}, causing
locals_dict to capture 'data' and 'locals_dict' as variables. The loop then
added these to the data dict itself, resulting in:
  data = {'team_id': 549, 'demotion_week': 7, 'data': {}, 'locals_dict': {...}}

When Peewee executed Player.update(**data), it tried to set Player.data = {},
but Player model has no 'data' field, causing AttributeError.

Solution:
1. Call locals() BEFORE creating data dict
2. Exclude 'locals_dict' from the filter (along with 'player_id', 'token')

This ensures only actual player field parameters are included in the update.

Version: 2.5.2 → 2.5.3

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 14:57:32 -06:00
..
routers_v3 fix: Prevent locals() from polluting player PATCH data dict 2026-02-04 14:57:32 -06:00
services fix: Resolve Player.data AttributeError in patch_player endpoint 2026-02-04 14:41:16 -06:00
__init__.py Initial commit 2023-03-21 16:09:46 -05:00
db_engine.py Add salary_cap column to Team model (v2.2.0) 2025-12-10 07:28:16 -06:00
dependencies.py Add CACHE_ENABLED env var to toggle Redis caching (v2.2.1) 2025-12-10 07:59:54 -06:00
main.py Added HelpCommands 2025-10-17 16:36:40 -05:00