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

TypeError: context must be a dict rather than RequestContext. #35

Open
lirik90 opened this issue Aug 11, 2017 · 0 comments
Open

TypeError: context must be a dict rather than RequestContext. #35

lirik90 opened this issue Aug 11, 2017 · 0 comments

Comments

@lirik90
Copy link

lirik90 commented Aug 11, 2017

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/telegrambot/bot_views/generic/base.py", line 20, in handle
text = TextResponse(self.template_text, ctx).render()
File "/usr/local/lib/python3.5/dist-packages/telegrambot/bot_views/generic/responses.py", line 30, in render
return template.render(ctx)
File "/usr/local/lib/python3.5/dist-packages/django/template/backends/django.py", line 64, in render
context = make_context(context, request, autoescape=self.backend.engine.autoescape)
File "/usr/local/lib/python3.5/dist-packages/django/template/context.py", line 287, in make_context
raise TypeError('context must be a dict rather than %s.' % context.class.name)
TypeError: context must be a dict rather than RequestContext.
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/telegrambot/views.py", line 22, in post
bot.handle(Update.de_json(request.data))
File "/usr/local/lib/python3.5/dist-packages/telegrambot/models/bot.py", line 51, in handle
callback(self, update, **callback_kwargs)
File "/usr/local/lib/python3.5/dist-packages/telegrambot/bot_views/generic/base.py", line 39, in view
return self.handle(bot, update, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/telegrambot/bot_views/generic/base.py", line 20, in handle
text = TextResponse(self.template_text, ctx).render()
File "/usr/local/lib/python3.5/dist-packages/telegrambot/bot_views/generic/responses.py", line 30, in render
return template.render(ctx)
File "/usr/local/lib/python3.5/dist-packages/django/template/backends/django.py", line 64, in render
context = make_context(context, request, autoescape=self.backend.engine.autoescape)
File "/usr/local/lib/python3.5/dist-packages/django/template/context.py", line 287, in make_context
raise TypeError('context must be a dict rather than %s.' % context.class.name)
TypeError: context must be a dict rather than RequestContext.
Error processing {'update_id': 508629733, 'message': <telegram.message.Message object at 0x7f10be6833c8>} for token ...

It is happiness when i try use someone from tests directory.
I can fix it if replace line 29 in file telegrambot/bot_views/generic/responses.py from:
ctx = RequestContext(HttpRequest(), self.ctx)
to:
ctx = self.ctx

But i dont know whats can happiness?
Please tell me right way to fix this issue?

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

1 participant