ASKBOT / askbot-devel

Askbot is a Django/Python Q&A forum. **Contributors README**: https://github.com/ASKBOT/askbot-devel#how-to-contribute. Commercial hosting of Askbot and support are available at https://askbot.com
Other
1.56k stars 628 forks source link

Error when user has custom avatar #927

Closed brunobastosg closed 1 year ago

brunobastosg commented 1 year ago

If a user has a custom avatar, or if it tries to upload a custom avatar, the following error occurs:

Traceback (most recent call last):
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/views/users.py", line 1447, in user
    return user_view_func(request, profile_owner, context)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/views/users.py", line 754, in user_stats
    return render(request, 'user_profile/user_stats.html', context)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/django/shortcuts.py", line 19, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/skins/template_backends.py", line 17, in render
    return super(Template, self).render(context, request)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/django/template/backends/jinja2.py", line 74, in render
    return self.template.render(context)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/jinja2/environment.py", line 1291, in render
    self.environment.handle_exception()
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/user_profile/user_stats.html", line 3, in top-level template code
    {% import "user_profile/macros.html" as user_profile_macros %}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/user_profile/user.html", line 71, in top-level template code
    {% block sidebar %}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/one_column_body.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/base.html", line 44, in top-level template code
    {% block body %}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/one_column_body.html", line 5, in block 'body'
    {% block content %}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/user_profile/user.html", line 24, in block 'content'
    {% block usercontent %}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/user_profile/user_stats.html", line 9, in block 'usercontent'
    {% include "user_profile/user_info.html" %}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/user_profile/user_info.html", line 9, in top-level template code
    {% include "user_profile/user_info_avatar_block.html" %}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/user_profile/user_info_avatar_block.html", line 2, in top-level template code
    {{ macros.gravatar(view_user, 128, hide_rep=True) }}
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/jinja2/runtime.py", line 828, in _invoke
    rv = self._func(*arguments)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/jinja2/macros.html", line 603, in template
    {{ simple_avatar({
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/models/__init__.py", line 246, in user_get_avatar_url
    url = self.calculate_avatar_url(size)
  File "/path/to/my/project/.venv/lib/python3.10/site-packages/askbot/models/__init__.py", line 316, in user_calculate_avatar_url
    avatar = get_primary_avatar(self, size=size)
TypeError: get_primary_avatar() got an unexpected keyword argument 'size'

I'm going to try and fix it.