Skip to content

Commit

Permalink
Merge branch 'release/v202410.1141'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasternak committed Oct 8, 2024
2 parents 7934880 + dd9043c commit 668af9b
Show file tree
Hide file tree
Showing 11 changed files with 419 additions and 208 deletions.
10 changes: 10 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ Historia zmian

.. towncrier release notes start
Bpp 202410.1141 (2024-10-08)
============================

Naprawione
----------

- parametryzacja czasu otwarcia połączeń + domyślne wyłączenie persistent connections na produkcji (do momentu Django 5,
gdzie można będzie użyć psycopg-pool)


Bpp 202410.1140 (2024-10-07)
============================

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ loc: clean
pygount -N ... -F "...,staticroot,migrations,fixtures" src --format=summary


DOCKER_VERSION="202410.1140"
DOCKER_VERSION="202410.1141"

DOCKER_BUILD=build --platform linux/amd64,linux/arm64 --push

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bpp-iplweb",
"version": "v202410.1140",
"version": "v202410.1141",
"license": "MIT",
"devDependencies": {
"grunt": ">=1.6.1",
Expand Down
572 changes: 383 additions & 189 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bpp_iplweb"
version = "202410.1140"
version = "202410.1141"
description = ""
authors = ["Michał Pasternak <michal.dtz@gmail.com>"]
license = "MIT"
Expand Down Expand Up @@ -113,7 +113,7 @@ pytest-rerunfailures = "^14.0"
django-debug-toolbar = "^4.4.6"

[tool.bumpver]
current_version = "v202410.1140"
current_version = "v202410.1141"
version_pattern = "vYYYY0M.BUILD[-TAGNUM][GITHASH]"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
Expand Down Expand Up @@ -141,7 +141,7 @@ simplejson = "3.17.5"
django-dbtemplates-iplweb = "4.1.0"
django-reversion = "5.0.4"
channels = { version = "~4", extras = ["daphne"] }
uvicorn = { version = "0.18.2", extras = ["standard"] }
uvicorn = {extras = ["standard"], version = "^0.31.0"}
channels-redis = "~4"
django-flexible-reports = ">0.2.9"
django-group-by = "0.3.1"
Expand Down Expand Up @@ -221,7 +221,7 @@ django-tinymce = "^3.6.1"
crispy-bootstrap5 = "^0.7"
crispy-bootstrap3 = "^2022.1"
twisted = {extras = ["http2", "tls"], version = "^24.3.0"}
psycopg = "^3.2.3"
psycopg2 = "^2.9.9"

[tool.poetry.dev-dependencies]
model-bakery = ">=1.5.1"
Expand Down Expand Up @@ -265,7 +265,7 @@ build-backend = "poetry.core.masonry.api"

[tool.towncrier]
package = "bpp"
version = "202410.1140"
version = "202410.1141"
package_dir = "src"
filename = "HISTORY.rst"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def requirements(fn="requirements.txt"):

setup(
name="bpp-iplweb",
version="202410.1140",
version="202410.1141",
description="System informatyczny do zarządzania bibliografią publikacji pracowników naukowych",
long_description=readme,
long_description_content_type="text/x-rst",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import date, datetime, timedelta

import pytest
from django.db import IntegrityError, OperationalError
from django.db import IntegrityError, InternalError, OperationalError
from model_bakery import baker

from bpp.models.autor import Autor_Jednostka
Expand All @@ -13,7 +13,7 @@ def test_autor_jednostka_trigger_nie_mozna_zmienic_id_autora(
):
aj = baker.make(Autor_Jednostka, autor=autor_jan_kowalski, jednostka=jednostka)
aj.autor = autor_jan_nowak
with pytest.raises(OperationalError):
with pytest.raises((OperationalError, InternalError)):
aj.save()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from django.core.exceptions import ValidationError
from django.db import OperationalError
from django.db import InternalError, OperationalError
from django.db.utils import IntegrityError
from model_bakery import baker

Expand Down Expand Up @@ -50,7 +50,7 @@ def test_jednostka_before_insert():
w1 = baker.make(Wydzial, uczelnia=u1)
w2 = baker.make(Wydzial, uczelnia=u2)

with pytest.raises(OperationalError):
with pytest.raises((OperationalError, InternalError)):
j = baker.make(Jednostka, uczelnia=u2, wydzial=w1)

j = baker.make(Jednostka, uczelnia=u2, wydzial=w2)
Expand All @@ -74,7 +74,7 @@ def test_jednostka_wydzial_before_insert():
assert j1.wydzial is None

jw = Jednostka_Wydzial(jednostka=j1, wydzial=w2)
with pytest.raises(OperationalError):
with pytest.raises((OperationalError, InternalError)):
jw.save()

jw = Jednostka_Wydzial.objects.create(jednostka=j1, wydzial=w1)
Expand Down Expand Up @@ -145,7 +145,7 @@ def test_jednostka_wydzial_time_trigger_delete_1():

jw1.jednostka = j2

with pytest.raises(OperationalError):
with pytest.raises((OperationalError, InternalError)):
jw1.save()

for elem in u1, w1, j1, j2, jw1:
Expand Down
12 changes: 11 additions & 1 deletion src/django_bpp/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
# serwisu + docelowo będzie pewnie można zrezygnować z wielu plików konfiguracyjnych
# (local, test, production).


def int_or_none(v):
try:
return int(v)
except ValueError:
return None


env = environ.Env(
# casting, default value
#
Expand Down Expand Up @@ -87,6 +95,7 @@
DJANGO_BPP_DB_PASSWORD=(str, "password"),
DJANGO_BPP_DB_HOST=(str, "localhost"),
DJANGO_BPP_DB_PORT=(int, 5432),
DJANGO_BPP_CONN_MAX_AGE=(int_or_none, 0),
DJANGO_BPP_DB_DISABLE_SSL=(bool, False),
DJANGO_BPP_SECRET_KEY=(str, SECRET_KEY_UNSET),
DJANGO_BPP_MEDIA_ROOT=(str, os.path.join(os.getenv("HOME", "C:/"), "bpp-media")),
Expand Down Expand Up @@ -502,12 +511,13 @@ def autoslug_gen():

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": env("DJANGO_BPP_DB_NAME"),
"USER": env("DJANGO_BPP_DB_USER"),
"PASSWORD": env("DJANGO_BPP_DB_PASSWORD"),
"HOST": env("DJANGO_BPP_DB_HOST"),
"PORT": env("DJANGO_BPP_DB_PORT"),
"CONN_MAX_AGE": env("DJANGO_BPP_CONN_MAX_AGE"),
},
}

Expand Down
3 changes: 0 additions & 3 deletions src/django_bpp/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440 * 3 # 7.5 MB
DATA_UPLOAD_MAX_NUMBER_FIELDS = 50000

# Persistent connections
DATABASES["default"]["CONN_MAX_AGE"] = None # noqa

CACHEOPS = {
"bpp.bppmultiseekvisibility": {"ops": ("get", "fetch")},
"dbtemplates.template": {"ops": ("fetch", "get")},
Expand Down
2 changes: 1 addition & 1 deletion src/django_bpp/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "202410.1140"
VERSION = "202410.1141"

if __name__ == "__main__":
import sys
Expand Down

0 comments on commit 668af9b

Please sign in to comment.