Skip to content

Commit

Permalink
Merge branch 'celery-get_current_registry' into test-celery-registry-…
Browse files Browse the repository at this point in the history
…setup
  • Loading branch information
Your Name committed Nov 20, 2023
2 parents 2f28d0f + ab1b834 commit 1e9584a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions weaver/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
from pyramid.settings import asbool, aslist
from pyramid.threadlocal import get_current_registry
from pyramid_beaker import set_cache_regions_from_settings
from pyramid_celery import celery_app as app
from requests import HTTPError as RequestsHTTPError, Response
from requests.structures import CaseInsensitiveDict
from requests_file import FileAdapter
Expand Down Expand Up @@ -468,6 +469,8 @@ def get_registry(container=None, nothrow=False):
return container.registry
if isinstance(container, Registry):
return container
if container is None and sys.argv[0].rsplit("/", 1)[-1] == "celery":
return app.conf.get("PYRAMID_REGISTRY", {})
if isinstance(container, WerkzeugRequest) or container is None:
return get_current_registry()
if nothrow:
Expand Down

0 comments on commit 1e9584a

Please sign in to comment.