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

AttributeError with async_ = True #41

Open
Loneattic opened this issue Jan 15, 2021 · 2 comments
Open

AttributeError with async_ = True #41

Loneattic opened this issue Jan 15, 2021 · 2 comments
Labels

Comments

@Loneattic
Copy link

TestAsyncBadge
class TestAsyncBadge(Badge):
   async_ = True
   slug = "test_async_badge"
   levels = [
       ...
   ]
   events = [
       "something_awarded",
   ]
   multiple = False

   def award(self, **state):
       ...

badges.register(TestAsyncBadge)
def test_func(self):
  badges.possibly_award_badge("something_awarded", user=self.user)
File "/usr/local/lib/python3.8/dist-packages/celery/app/task.py", line 426, in delay
    return self.apply_async(args, kwargs)
    
AttributeError: 'TestAsyncBadge' object has no attribute 'apply_async'
Celery.py
app = Celery('appname')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()

celery 4.4.7

@Loneattic Loneattic added the bug label Jan 15, 2021
@eon01
Copy link

eon01 commented Feb 13, 2021

I have the same problem with celery==5.0.5

@piraka9011
Copy link

@Loneattic @eon01 if you can, maybe try the proposed changes in #43 and see if that resolves your issue?
You can run:

pip install -e git+https://github.com/piraka9011/pinax-badges.git

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

Successfully merging a pull request may close this issue.

3 participants