Is this a bug I should report, or have I misconfigured?

Feb 20 22:12:35 OpenEdX4 [service_variant=lms][django.request][env:sandbox] 
ERROR [OpenEdX4  3812] [base.py:256] - Internal Server Error: /courses/
course-v1:mycourseid/about
Traceback (most recent call last):
  File 
"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py"
, line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File 
"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py"
, line 145, in inner
    return func(*args, **kwargs)
  File 
"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py"
, line 110, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/util/views.py", line 
49, in inner
    response = view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/common/djangoapps/util/cache.py", line 
83, in wrapper
    return view_func(request, *args, **kwargs)
  File 
"/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py", 
line 762, in course_about
    registration_price, course_price = get_course_prices(course)
  File 
"/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/views/views.py", 
line 607, in get_course_prices
    settings.PAID_COURSE_REGISTRATION_CURRENCY[0]
  File 
"/edx/app/edxapp/edx-platform/common/djangoapps/course_modes/models.py", 
line 649, in min_course_price_for_currency
    return min(mode.min_price for mode in modes if mode.currency.lower() == 
currency.lower())
ValueError: min() arg is an empty sequence

In the meantime, I've rewritten mine to:
    
@classmethod
    def min_course_price_for_currency(cls, course_id, currency):
        """
        Returns the minimum price of the course in the appropriate currency 
over all the course's
        non-expired modes.
        If there is no mode found, will return the price of DEFAULT_MODE, 
which is 0
        """
        modes = cls.modes_for_course(course_id)
        if modes:
            return min(mode.min_price for mode in modes if mode.currency.
lower() == currency.lower())
        return cls.DEFAULT_MODE

(was: 
https://github.com/edx/edx-platform/blob/25130ae3c8333e5353ab88860c76619ebb9098f9/common/djangoapps/course_modes/models.py#L674
 
)

-- 
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/854abfd4-32f1-486b-99dd-95c9ae9ab327%40googlegroups.com.

Reply via email to