Skip to content

Commit

Permalink
feat: Support viur-core>=3.7; Use _private_bucket for reports' st…
Browse files Browse the repository at this point in the history
…orage place (#19)

For now it's intended to save reports into the private bucket.

This PR is related to PRs from viur-core :
viur-framework/viur-core#1266 and
viur-framework/viur-core#1268

---------

Co-authored-by: Sven Eberth <mail@sveneberth.de>
  • Loading branch information
skoegl and sveneberth authored Oct 18, 2024
1 parent b0b5692 commit ecf83e0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/viur/toolkit/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
from google.cloud.storage import Bucket

from viur.core import email
from viur.core.modules.file import GOOGLE_STORAGE_BUCKET
from viur.core.version import __version__ as core_version
from viur.core.modules.file import File

__all__ = ["Report"]

logger = logging.getLogger(__name__)

GOOGLE_STORAGE_BUCKET: Bucket = GOOGLE_STORAGE_BUCKET
"""Main GOOGLE_STORAGE_BUCKET (here reassigned to add the type hint)"""

if tuple(map(int, core_version.split(".", 2)[:2])) >= (3, 7):
GOOGLE_STORAGE_BUCKET: Bucket = File.get_bucket("")
"""Main (private) GOOGLE_STORAGE_BUCKET"""
else:
from viur.core.modules.file import GOOGLE_STORAGE_BUCKET # type: ignore[no-redef]
GOOGLE_STORAGE_BUCKET: Bucket = GOOGLE_STORAGE_BUCKET
"""Main GOOGLE_STORAGE_BUCKET (here reassigned to add the type hint)"""

class Report:
"""Reports are a kind of logging
Expand Down

0 comments on commit ecf83e0

Please sign in to comment.