frappe / frappe

Low code web framework for real world applications, in Python and Javascript
https://frappeframework.com
MIT License
7.25k stars 3.44k forks source link

Blog Page Error #19821

Closed jpettan closed 3 months ago

jpettan commented 1 year ago

Description of the issue

Created the first blog as per the documentation shared. Using frappecloud instance. After creating the blog and publishing the same. Clicked on view on website and untaught server exception is displayed.

Context information (for bug reports)

Output of bench version

(paste here)

Steps to reproduce the issue

  1. Create a blog
  2. Publish
  3. Click ‘view on website’

Observed result

Traceback (most recent call last): File "apps/frappe/frappe/website/serve.py", line 18, in get_response response = renderer_instance.render() File "apps/frappe/frappe/website/page_renderers/document_page.py", line 52, in render html = self.get_html() File "apps/frappe/frappe/website/utils.py", line 510, in cache_html_decorator html = func(*args, *kwargs) File "apps/frappe/frappe/website/page_renderers/document_page.py", line 63, in get_html html = frappe.get_template(self.template_path).render(self.context) File "env/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "env/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "apps/frappe/frappe/website/doctype/blog_post/templates/blog_post.html", line 1, in top-level template code {% extends "templates/web.html" %} File "apps/frappe/frappe/templates/web.html", line 1, in top-level template code {% extends base_template_path %} File "apps/frappe/frappe/templates/base.html", line 70, in top-level template code {% block content %} File "apps/frappe/frappe/templates/web.html", line 72, in block 'content' {{ main_content() }} File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call return context.call(obj, args, kwargs) File "env/lib/python3.10/site-packages/jinja2/runtime.py", line 777, in _invoke rv = self._func(arguments) File "apps/frappe/frappe/templates/web.html", line 15, in template {% block page_container %} File "apps/frappe/frappe/templates/web.html", line 30, in block 'page_container' {%- block page_content -%}{%- endblock -%} File "apps/frappe/frappe/website/doctype/blog_post/templates/blog_post.html", line 65, in block 'page_content' {% include "templates/includes/blog/blogger.html" %} File "apps/frappe/frappe/templates/includes/blog/blogger.html", line 4, in top-level template code {{ avatar(full_name=blogger_info.full_name, image=blogger_info.avatar, size='avatar-large') }} File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call return context.call(obj, args, kwargs) File "env/lib/python3.10/site-packages/jinja2/runtime.py", line 777, in _invoke rv = self._func(arguments) File "apps/frappe/frappe/templates/includes/avatar_macro.html", line 2, in template {% set user_info = frappe.utils.get_user_info_for_avatar(user_id) %} File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call return context.call(obj, args, **kwargs) File "apps/frappe/frappe/utils/data.py", line 2069, in get_user_info_for_avatar return {"email": user.email, "image": user.user_image, "name": user.full_name} AttributeError: 'User' object has no attribute 'email'

Expected result

Stacktrace / full error message


Traceback (most recent call last):
  File "apps/frappe/frappe/website/serve.py", line 18, in get_response
    response = renderer_instance.render()
  File "apps/frappe/frappe/website/page_renderers/document_page.py", line 52, in render
    html = self.get_html()
  File "apps/frappe/frappe/website/utils.py", line 510, in cache_html_decorator
    html = func(*args, **kwargs)
  File "apps/frappe/frappe/website/page_renderers/document_page.py", line 63, in get_html
    html = frappe.get_template(self.template_path).render(self.context)
  File "env/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "env/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "apps/frappe/frappe/website/doctype/blog_post/templates/blog_post.html", line 1, in top-level template code
    {% extends "templates/web.html" %}
  File "apps/frappe/frappe/templates/web.html", line 1, in top-level template code
    {% extends base_template_path %}
  File "apps/frappe/frappe/templates/base.html", line 70, in top-level template code
    {% block content %}
  File "apps/frappe/frappe/templates/web.html", line 72, in block 'content'
    {{ main_content() }}
  File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "env/lib/python3.10/site-packages/jinja2/runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
  File "apps/frappe/frappe/templates/web.html", line 15, in template
    {% block page_container %}
  File "apps/frappe/frappe/templates/web.html", line 30, in block 'page_container'
    {%- block page_content -%}{%- endblock -%}
  File "apps/frappe/frappe/website/doctype/blog_post/templates/blog_post.html", line 65, in block 'page_content'
    {% include "templates/includes/blog/blogger.html" %}
  File "apps/frappe/frappe/templates/includes/blog/blogger.html", line 4, in top-level template code
    {{  avatar(full_name=blogger_info.full_name, image=blogger_info.avatar, size='avatar-large') }}
  File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "env/lib/python3.10/site-packages/jinja2/runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
  File "apps/frappe/frappe/templates/includes/avatar_macro.html", line 2, in template
    {% set user_info = frappe.utils.get_user_info_for_avatar(user_id) %}
  File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "apps/frappe/frappe/utils/data.py", line 2069, in get_user_info_for_avatar
    return {"email": user.email, "image": user.user_image, "name": user.full_name}
AttributeError: 'User' object has no attribute 'email'

(paste here)

Additional information

OS version / distribution, Frappe install method, etc. Not sure.. using frappecloud version 14 and I have installed all updated as of today.

Nihantra-Patel commented 3 months ago

Kindly upgrade to version 14 or 15, then refresh and check again because lots of bugs fixed in the new version.

Everything is working fine. No problems were encountered in the latest versions 14 and 15.