Skip to content

DB Fix#134

Merged
hubert-marek merged 2 commits intomainfrom
fixes-kdd
Feb 11, 2026
Merged

DB Fix#134
hubert-marek merged 2 commits intomainfrom
fixes-kdd

Conversation

@hubert-marek
Copy link
Collaborator

No description provided.

@claude
Copy link

claude bot commented Feb 11, 2026

Code Review

I found 4 critical syntax errors in this PR that will prevent the module from importing:


Issue: Invalid Python 3 exception syntax (4 occurrences)

File: backend/src/services/calendar/database/operations.py

Lines: 2006, 2573, 2729, 2742

Problem: The PR changes the exception handling syntax from except (ValueError, TypeError): to except ValueError, TypeError: (removing the parentheses). This is invalid Python 3 syntax and will cause a SyntaxError when the module is imported.

In Python 3, you must use parentheses to catch multiple exception types:

  • ✅ Correct: except (ValueError, TypeError):
  • ❌ Invalid: except ValueError, TypeError:

The comma syntax without parentheses was Python 2 syntax for binding the exception to a variable (equivalent to except ValueError as TypeError: in Python 3).

Impact: The module will fail to import, crashing the calendar service at startup.

Locations:

  1. Line 2006:

    start_dt = parsed_dt
    except ValueError, TypeError:
    start_dt = now_local.replace(minute=0, second=0, microsecond=0) + timedelta(
    hours=1
    )

    except ValueError, TypeError:  # ❌ Should be: except (ValueError, TypeError):
  2. Line 2573:

    target_tz = ZoneInfo(time_zone)
    except KeyError, ValueError:
    # Invalid timezone - fall back to UTC
    pass

    except KeyError, ValueError:  # ❌ Should be: except (KeyError, ValueError):
  3. Line 2729:

    start_dt = start_dt.replace(tzinfo=event_tz)
    except KeyError, ValueError:
    start_dt = start_dt.replace(tzinfo=dt_timezone.utc)
    elif start_dt.tzinfo is None:
    start_dt = start_dt.replace(tzinfo=dt_timezone.utc)

    except KeyError, ValueError:  # ❌ Should be: except (KeyError, ValueError):
  4. Line 2742:

    end_dt = end_dt.replace(tzinfo=end_tz)
    except KeyError, ValueError:
    end_dt = end_dt.replace(tzinfo=dt_timezone.utc)
    elif end_dt.tzinfo is None:
    end_dt = end_dt.replace(tzinfo=dt_timezone.utc)

    except KeyError, ValueError:  # ❌ Should be: except (KeyError, ValueError):

Fix: Restore the parentheses around the exception tuples at all 4 locations.


The other changes in this PR (middleware.py, routes.py, environment.py) look correct.

@hubert-marek
Copy link
Collaborator Author

@claude change excepts pls

@claude
Copy link

claude bot commented Feb 11, 2026

Claude finished @hubert-marek's task in 1m 17s —— View job


Fixed Exception Syntax Errors ✓

Todo List:

  • Read operations.py to confirm syntax errors
  • Fix exception syntax at line 2006
  • Fix exception syntax at line 2573
  • Fix exception syntax at line 2729
  • Fix exception syntax at line 2742
  • Commit and push changes

Summary

Fixed all 4 Python 3 exception syntax errors in backend/src/services/calendar/database/operations.py by adding the missing parentheses around exception tuples:

  • Line 2006: except ValueError, TypeError:except (ValueError, TypeError):
  • Line 2573: except KeyError, ValueError:except (KeyError, ValueError):
  • Line 2729: except KeyError, ValueError:except (KeyError, ValueError):
  • Line 2742: except KeyError, ValueError:except (KeyError, ValueError):

The module will now import correctly without syntax errors.

Branch: fixes-kdd

Add missing parentheses around exception tuples for Python 3 compatibility.
Fixed 4 occurrences at lines 2006, 2573, 2729, and 2742.

Co-authored-by: Hubert <hubert-marek@users.noreply.github.com>
@hubert-marek hubert-marek merged commit 5857db0 into main Feb 11, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments