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

Changing instances of ugettext, ugettext_lazy, ungettext, and force_unicode for Django 4.0 #617

Open
TomBlackwoodTTM opened this issue May 26, 2022 · 2 comments

Comments

@TomBlackwoodTTM
Copy link

Hi,

I don't know if people running Django 4.0 will be using django-celery but I had to make some fixes to djcelery in order to get it working.

I had to delete the u from:

  • ugettext to just gettext
  • ugettext_lazy to just gettext_lazy
  • ungettext to use ngettext and then import it as ungettext to leave the rest of the code "reasonably unchanged".

Lastly I changed the force_unicode (force_text) import to import force_str as force_text

The files affected I think were:

  • djcelery/admin.py
  • djcelery/humanize.py
  • djcelery/models.py
  • djcelery/picklefield.py

It imports correctly now but I can keep you posted on if it breaks!

@muhammadfarizarya
Copy link

Hi,

I have changed files that you mention and did what you say, and now it throw an error like this :

File "/home/fariz/.virtualenvs/boxsurat/lib/python3.8/site-packages/djcelery/models.py", line 17, in
from .picklefield import PickledObjectField
File "/home/fariz/.virtualenvs/boxsurat/lib/python3.8/site-packages/djcelery/picklefield.py", line 22, in
from celery.five import with_metaclass
ModuleNotFoundError: No module named 'celery.five'

@muhammadfarizarya
Copy link

Hi,

I've been looking for a solution and doing this to got it working for a while but I don't know what effect I did

The files :

  • djcelery/admin.py
  • djcelery/picklefield.py

what I did:

  • remove from celery.five import with_metaclass
  • change from celery.app.control import broadcast, revoke, rate_limit to from celery.worker.control import revoke, rate_limit
  • change 'broadcast()' to self.app.control.broadcast()

I hope it can work well

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

No branches or pull requests

2 participants