Internal
Public Access
Fix Critical Security Issue: Replace print() with proper logging
Replaced all debug print() statements with proper logging framework: - tasks/views.py: 5 print statements → logger.debug() - sync/views.py: 15 print statements → logger.debug() - config/celery.py: 1 print statement → logger.debug() - notifications/tasks.py: 2 print statements → logger.error() Retained print() in settings files (development.py, selfhosted.py) as they are appropriate warnings to stderr for configuration issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.5
parent
a22c3eed50
commit
b57321e1e4
+8
-5
@@ -2,6 +2,7 @@
|
||||
Task views for KeepItGoing.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db.models import Q
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
@@ -22,6 +23,8 @@ from .serializers import (
|
||||
TaskShareSerializer,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# API Views
|
||||
@@ -553,7 +556,7 @@ def task_detail_partial(request, task_id):
|
||||
def web_timer_start(request, task_id):
|
||||
"""Start a timer for a task (web view)."""
|
||||
task = get_object_or_404(Task, id=task_id, user=request.user)
|
||||
print(f"[WEB TIMER DEBUG] Starting timer for task: {task.title} (id: {task_id})")
|
||||
logger.debug(f"Starting timer for task: {task.title} (id: {task_id})")
|
||||
|
||||
# Stop any existing running timer first (properly to calculate duration)
|
||||
running_entries = TimeEntry.objects.filter(
|
||||
@@ -567,7 +570,7 @@ def web_timer_start(request, task_id):
|
||||
entry.save() # This will calculate duration_seconds
|
||||
stopped_count += 1
|
||||
|
||||
print(f"[WEB TIMER DEBUG] Stopped {stopped_count} existing timers")
|
||||
logger.debug(f"Stopped {stopped_count} existing timers")
|
||||
|
||||
# Create new timer
|
||||
entry = TimeEntry.objects.create(
|
||||
@@ -575,7 +578,7 @@ def web_timer_start(request, task_id):
|
||||
user=request.user,
|
||||
started_at=timezone.now()
|
||||
)
|
||||
print(f"[WEB TIMER DEBUG] Created new timer entry: {entry.id}")
|
||||
logger.debug(f"Created new timer entry: {entry.id}")
|
||||
|
||||
next_url = request.POST.get('next', 'dashboard')
|
||||
return redirect(next_url)
|
||||
@@ -585,7 +588,7 @@ def web_timer_start(request, task_id):
|
||||
@require_POST
|
||||
def web_timer_stop(request, task_id):
|
||||
"""Stop a timer for a task (web view)."""
|
||||
print(f"[WEB TIMER DEBUG] Stopping timer for task_id: {task_id}")
|
||||
logger.debug(f"Stopping timer for task_id: {task_id}")
|
||||
|
||||
# Get the running timer and stop it properly (to trigger save() and calculate duration)
|
||||
entries = TimeEntry.objects.filter(
|
||||
@@ -600,7 +603,7 @@ def web_timer_stop(request, task_id):
|
||||
entry.save() # This will calculate duration_seconds
|
||||
stopped_count += 1
|
||||
|
||||
print(f"[WEB TIMER DEBUG] Stopped {stopped_count} timer entries")
|
||||
logger.debug(f"Stopped {stopped_count} timer entries")
|
||||
|
||||
next_url = request.POST.get('next', 'dashboard')
|
||||
return redirect(next_url)
|
||||
|
||||
Reference in New Issue
Block a user