Certificate preview error

112 views
Skip to first unread message

Daniel

unread,
Nov 5, 2016, 11:01:26 AM11/5/16
to General Open edX discussion
Nov  5 16:59:39 ubuntu [service_variant=lms][util.views][env:sandbox] ERROR [ubuntu  14460] [views.py:114] - Error in django view.
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/common/djangoapps/util/views.py", line 105, in inner
    return func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/views/webview.py", line 568, in render_html_view
    _update_context_with_user_info(context, user, user_certificate)
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/views/webview.py", line 306, in _update_context_with_user_info
    user_name=user_fullname
KeyError: u'username'

Please help))

Olga Filipova

unread,
Dec 31, 2016, 9:21:19 AM12/31/16
to General Open edX discussion
I got the same error when using non-english language, with english everything is perfect. Have you figured out the problem?

Bryan Wilson (Appsembler)

unread,
Jan 3, 2017, 4:52:16 PM1/3/17
to General Open edX discussion
The Python string formatting code in lms/djangoapps/certificates/view/webview.py do not use unicode and will break when encountering non-ASCII text, for example, in a user's name or in a course name, or even the platform name.  I have fixed these errors for one of our customer's sites and am working on filing an issue/fix.  I'll repost here when I have done that.  

Andy Armstrong

unread,
Jan 7, 2017, 12:10:10 PM1/7/17
to edx-...@googlegroups.com
Daniel and I just tracked down this issue. There were translations that should have had the placeholder {user_name} but instead had {username}. The error is because the code was trying to format the string, but there was no value provided for {username}. The KeyError is format's very unhelpful error message saying that it couldn't format the message because the placeholder with the given name was missing.

I've created a localization FAQ and described this problem and the solution here:


 - Andy

--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/d258ade1-e64e-4135-a749-0568d86eef16%40googlegroups.com.



--

Andy Armstrong

edX | UI Architect  | an...@edx.org  

141 Portland Street, 9th floor

Cambridge, MA 02139

http://www.edx.org

http://www.e-learn.nl/media/blogs/e-learn/edX_Logo_Col_RGB_FINAL.jpg?mtime=1336074566
Reply all
Reply to author
Forward
0 new messages