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

Import django-tidings files #5137

Merged
merged 1 commit into from Jun 8, 2022
Merged

Conversation

akatsoulas
Copy link
Collaborator

  • Update imports
  • Use only python3

@akatsoulas akatsoulas marked this pull request as draft May 20, 2022 15:20
@akatsoulas akatsoulas marked this pull request as ready for review May 25, 2022 14:50
@akatsoulas akatsoulas force-pushed the import-tidings branch 2 times, most recently from a4d33b4 to 12f8533 Compare May 25, 2022 14:54
* Update imports
* Use only python3
* import tidings migrations
* drop django-tidings
@akatsoulas akatsoulas merged commit bb65b02 into mozilla:main Jun 8, 2022
@akatsoulas akatsoulas deleted the import-tidings branch June 8, 2022 15:57
from django.contrib.sites.models import Site
from django.db import connections, models, router

from .utils import import_from_setting, reverse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Perhaps for consistency with all of the other kitsune.tidings imports within this sub-package, we should make this an absolute import?

from kitsune.tidings.utils import import_from_setting, reverse

from celery import task
from django.conf import settings
from django.contrib.auth.models import User
from django.db import connection, transaction
from sentry_sdk import capture_exception

# NOTE: This import is just so _fire_task gets registered with celery.
import kitsune.tidings.events # noqa
Copy link
Contributor

@escattone escattone Jun 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if it might be better to register the tidings Celery tasks in the app config? What if we change the tidings app config to something like:

class TidingsConfig(AppConfig):
    name = "kitsune.tidings"
    default_auto_field = "django.db.models.AutoField"

    def ready(self):
        # Register the tidings Celery tasks.
        from kitsune.tidings import events, tasks  # noqa

and then move kitsune.tidings in the order of INSTALLED_APPS such that it's the first of the kitsune apps? Something we can consider later if at all, just thinking out loud.

@escattone
Copy link
Contributor

escattone commented Jun 15, 2022

@akatsoulas I had the two thoughts above (which you can do with as you wish), and one more thing. I think we should add the unit tests from https://github.com/mozilla/django-tidings/tree/master/tests as well. Overall, this looks excellent to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants