Skip to content

Commit c9c9f96

Browse files
authoredMay 8, 2025··
Merge pull request #28 from sio2project/tests
More tests
2 parents d00f3d3 + 2307651 commit c9c9f96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1516
-102
lines changed
 

‎example_workflows/string_regs.json

Lines changed: 629 additions & 0 deletions
Large diffs are not rendered by default.

‎src/sio3pack/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,21 @@ def from_file(file: str | LocalFile, configuration: SIO3PackConfig = None) -> Pa
2222
return Package.from_file(file, configuration=configuration)
2323

2424

25-
def from_db(problem_id: int) -> Package:
25+
def from_db(problem_id: int, configuration: SIO3PackConfig = None) -> Package:
2626
"""
2727
Initialize a package object from the database.
2828
If sio3pack isn't installed with Django support, it should raise an ImproperlyConfigured exception.
2929
If there is no package with the given problem_id, it should raise an UnknownPackageType exception.
3030
3131
:param problem_id: The problem id.
32+
:param configuration: Configuration of the package.
3233
:return: The package object.
3334
"""
3435
try:
35-
import django
36+
from django.conf import settings
3637

37-
return Package.from_db(problem_id)
38+
configuration = configuration or SIO3PackConfig()
39+
configuration.django_settings = settings
40+
return Package.from_db(problem_id, configuration)
3841
except ImportError:
3942
raise ImproperlyConfigured("sio3pack is not installed with Django support.")

0 commit comments

Comments
 (0)
Please sign in to comment.