Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning fixes #11520

Merged
merged 3 commits into from
Nov 13, 2023
Merged

Commits on Nov 10, 2023

  1. Don't leak open server PID file

    Running with PYTHONWARNINGS=all reveals:
    
    ```
    <venv>/lib/python3.9/site-packages/kolibri/utils/server.py:881: ResourceWarning: unclosed file <_io.TextIOWrapper name='<homedir>/server.pid' mode='r' encoding='UTF-8'>
      pid_file_lines = open(filename, "r").readlines()
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    ```
    dbnicholson committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    ebe9416 View commit details
    Browse the repository at this point in the history
  2. Don't leak open version file

    Running with PYTHONWARNINGS=all reveals:
    
    ```
    <venv>/kolibri/utils/main.py:100: ResourceWarning: unclosed file <_io.TextIOWrapper name='<homedir>/.data_version' mode='r' encoding='UTF-8'>
      version = open(version_file(), "r").read()
    ```
    dbnicholson committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    2c8a828 View commit details
    Browse the repository at this point in the history
  3. Explicitly set on_delete for ForeignKey fields

    Running with PYTHONWARNINGS=all reveals several deprecation warnings
    that `on_delete` must be specified for `ForeignKey` fields:
    
    ```
    RemovedInDjango20Warning: on_delete will be a required arg for
    ForeignKey in Django 2.0. Set it to models.CASCADE on models and in
    existing migrations if you want to maintain the current default
    behavior. See https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.ForeignKey.on_delete
    ```
    dbnicholson committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    8c214f5 View commit details
    Browse the repository at this point in the history