From 65cbcf2282395c76f22708cb46880359197e9b8d Mon Sep 17 00:00:00 2001 From: BogPlaymate Date: Tue, 9 Jul 2024 18:01:44 +0900 Subject: [PATCH] I made a minor error in the last push, so am pushing this again. Config file changes This file can now be pushed to the main branch. The following changes have taken place: 1) Removed my personal data. 2) Made it compliant with pydantic 2. This involved: a) Changing the way of noting optional strings (now 'none' strings). This is as elegant as is possible. b) Updating the imports. Origin code results in "pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.7/migration/#basesettings-has-moved-to-pydantic-settings for more details. c) converting urls using the str() method. Origin code results in AttributeError: 'pydantic_core._pydantic_core.Url' object has no attribute 'decode' For further information visit https://errors.pydantic.dev/2.7/u/import-error" New developers will still need to fill out the mail_address, mail_password, mail_username, mail_port and secret_key before they can run the code. This is by design, though. --- classquiz/config.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/classquiz/config.py b/classquiz/config.py index efede3a..7636bc2 100644 --- a/classquiz/config.py +++ b/classquiz/config.py @@ -35,12 +35,12 @@ class Settings(BaseSettings): db_url: str | PostgresDsn = "postgresql://postgres:mysecretpassword@localhost:5432/classquiz" hcaptcha_key: str | None = None recaptcha_key: str | None = None - mail_address: str | None = None #from here - mail_password: str | None = None - mail_username: str | None = None - mail_server: str | None = None - mail_port: int | None = None - secret_key: str = "secretkey" # to here + mail_address: str + mail_password: str + mail_username: str + mail_server: str + mail_port: int + secret_key: str access_token_expire_minutes: int = 30 cache_expiry: int = 86400 sentry_dsn: str | None = None