Commit Graph

3974 Commits

Author SHA1 Message Date
Feanil Patel
05ab349c88 Merge pull request #22068 from edx/feanil/get_out_of_a_pickle
Create a custom Pickle Serializer
2019-10-18 14:48:24 -04:00
Feanil Patel
bfc02dc3ab Create custom pickle serializer.
We need to do this because when I tride to go to the JSON serializer a
bunch of tests started failing because various parts of our code are
putting things into the session that are not JSON serializable.

We can't keep using the default pickle serializer because it defaluts to
using the highest available protocol and that will cause issues with the
python 2 to 3 upgrade since both will be running in production at the
same time.  We need to use a version of the pickle protocol that both
can use interchangably.

We also need to make sure we read with latin1 encoding to make datetimes
work correctly between the two versions of python.
2019-10-18 13:46:47 -04:00
Feanil Patel
1b1d428630 Merge pull request #22069 from edx/feanil/lock_cache_pickles
Set cache pickle protocol to 2.
2019-10-18 13:41:35 -04:00
Feanil Patel
59b0554c37 Update encoding to be latin1 when loading pickled data to be able to read python 2 datettimes. 2019-10-18 13:04:19 -04:00
Ned Batchelder
855346e9e1 Merge pull request #22042 from mahyard/activation-email-to-ace
Activation email to ace
2019-10-18 12:10:20 -04:00
Feanil Patel
29cc071edd Set cache pickle protocol to 2.
HIGHEST_PROTOCOL will cause it to change when we move from python 2 to 3
and this may cause issues as older machines try to read objects pickeld
with a version of the protocol they don't know.

During deploys, and if we have to roll back are two examples.
2019-10-18 10:43:04 -04:00
Emma Green
bb14195685 Merge pull request #22067 from edx/move-anon-user-check-earlier
move the anonymous check earlier so that it cannot error out when it …
2019-10-17 13:35:23 -04:00
Emma Green
def6bced98 move the anonymous check earlier so that it cannot error out when it expects a non-anonymous user 2019-10-17 12:54:36 -04:00
Calen Pennington
7ceb0e30fa Mark course outline with graded and scored status in the DOM so that we can run optimizely code on them 2019-10-17 12:14:49 -04:00
Matthew Piatetsky
7436f9c186 Merge pull request #21915 from edx/REV-733
[REV-733] check if discount expired
2019-10-16 12:03:58 -04:00
Matthew Piatetsky
f6d0bf77df check if discount expired 2019-10-16 11:32:27 -04:00
Aarif
6e7f2f61ef Merge pull request #21994 from edx/BOM-914
Fixed all instances of "TypeError: a bytes-like object is required, not 'str" - BOM-914
2019-10-16 01:44:31 +05:00
Ned Batchelder
69255bee73 Merge pull request #21816 from regisb/regisb/simplify-swagger-auto-schema
Regisb/simplify swagger auto schema
2019-10-15 14:35:46 -04:00
Zia Fazal
ebe29d9303 Merge pull request #21943 from edx/ziafazal/ENT-1688
ENT-1688: Changed logout message on on logout screen for Enterprise SSO flow
2019-10-15 18:53:34 +05:00
Bill DeRusha
d9180b472d Merge pull request #22006 from edx/bderusha/remove-mailchimp
remove mailchimp tracking
2019-10-15 09:47:08 -04:00
Zia Fazal
c718c02d6e Show blank screen instead of logout message for Enterprise SSO flow
Changes to show blank screen instead of logout message for Enterprise SSO flow. It confuses learner when they are already signed in and access their course from B2B site.
ENT-1688

Fixed pep8 quality violation

use testserver as HOST instead of edx.org

assert enterprise app is enabled

added logging

Print different values

Reload django url config

assert all quote operations to see how they work on jenkins

debug url resolved values

login user in setup

added log to debug test on jenkins

Using UrlResetMixin

Using regex instead of resolve

Fixed quality violation

Fixed pylint quality violations

Fixed target interpolation syntax

Added developer's comment
2019-10-15 18:28:19 +05:00
Zia Fazal
0358587320 Merge pull request #22039 from edx/ziafazal/ENT-2384
ENT-2384: Invoke learner transmission task only for enterprise learners
2019-10-15 16:42:13 +05:00
Zia Fazal
3b69a4f279 Invoke learner transmission task only for enterprise learners
Invoke learner transmission task only for enterprise learners
ENT-2384

added docstring

Fixed brokent unit test
2019-10-15 15:58:37 +05:00
Ayub
f08a7e7268 Merge pull request #22032 from edx/BOM-xblock-recommender-tests-fix
BOM Project Xblock Recommber integration tests fix
2019-10-15 13:03:40 +05:00
Awais Qureshi
f7adc71c44 BOM-924
Fixing TypeError, the JSON object must be str, not 'bytes'.
2019-10-15 12:11:24 +05:00
Shadi Naif
7984c37a4f Convert Account Activation Emails to edx-ACE 2019-10-14 17:22:03 +03:30
aarif
d176957708 Updated the tests to fix the string/bytes input
changes made to pass tests with python 2 and other minor changes

Updated the tests to fix the string/bytes input

changes made to pass tests with python 2 and other minor changes

made some changes as suggested

made changes as suggested

changes made as suggested
2019-10-14 18:47:18 +05:00
Ayub khan
f0133d861d BOM Project Xblock Recommber integration tests fix
Python3 json can not work with bytes type input so used simplejson
instead of python json which works with both bytes and unicode
type input.
Previously we mistakenly updated StringIO to six.String io. which
caused the tests failure. Used io.BytesIO to fix the issues as
assci character bytes can not be converted to unicode.
2019-10-14 18:20:42 +05:00
aarif
6c98571bbd removed unnecessary encode method to fix input to csv write method
removed unnecessary encode method to fix input to csv write method
2019-10-14 16:17:11 +05:00
Régis Behmo
ae216c8584 Rename API decorators to "apidocs" to be provider-agnostic
The API documentation decorators do not have to leak which solution we
use to generate the docs. Here, and as discussed in PR #21820, we rename
the `openapi` module to `apidocs`, and we make sure that this module
includes all the right functions to document API Views without referring
to Open API.
2019-10-14 08:14:18 +02:00
Régis Behmo
1d9a5ab4e7 Rename swagger_auto_schema decorator 2019-10-14 08:14:08 +02:00
Régis Behmo
e78d69695d Ensure proper arguments in swagger decorator 2019-10-14 08:14:08 +02:00
Régis Behmo
59635b689e Simplify BookmarksListView.get docs
Instead of relying on a `method_decorator`, we explicitely declare the
`get` method.
2019-10-14 08:14:08 +02:00
Régis Behmo
dac393e9e7 Auto-document API endpoints using view function docstring
The `swagger_auto_schema` view function decorator allows us to
auto-document API endpoints. All swagger arguments are passed as kwargs
to the decorator, but this feels a bit unnatural: we would like to use
the function documentation as the endpoint summary and description. We
introduce this feature here by reading the `__doc_`_attribute of the
view function.
2019-10-14 08:14:08 +02:00
Awais Qureshi
14e8e782c9 Merge pull request #22013 from edx/awais786/BOM-917
BOM-917
2019-10-12 13:12:12 +05:00
Bill DeRusha
5a6b51bccf remove mailchimp tracking 2019-10-11 15:38:05 -04:00
Calen Pennington
501cd6795b Merge pull request #22001 from cpennington/no-discount-for-anonymous-users
Don't try to show anonymous users the first-purchase discount
2019-10-11 12:44:42 -04:00
Awais Qureshi
ae9dcdef8a BOM-917
Fix encoding issue.
2019-10-11 20:12:34 +05:00
AsadAzam
b8a19b7b92 Merge pull request #21809 from edx/asad/prod-694
Upgrade python 3 decode error
2019-10-11 17:22:29 +05:00
Jeremy Bowman
9c92bd96ed Fix assertions failing under Python 3 BOM-668 (#21978) 2019-10-10 15:22:07 -04:00
Calen Pennington
355826f7d8 Don't try to show anonymous users the first-purchase discount
This fixes errors like:

    Oct 10 12:46:07 ip-10-2-10-15 [service_variant=lms][django.request][env:prod-edx-edxapp] ERROR [ip-10-2-10-15  31278] [user None] [exception.py:135] - Internal Server Error: /courses/course-v1:HarvardX+1962USRx+3T2019/discussions/settings
    Traceback (most recent call last):
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
        response = get_response(request)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
        response = self._get_response(request)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
        response = self.process_exception_by_middleware(e, request)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, 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 185, in inner
        return func(*args, **kwargs)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/newrelic/hooks/framework_django.py", line 539, in wrapper
        return wrapped(*args, **kwargs)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/decorators/http.py", line 40, in inner
        return func(request, *args, **kwargs)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
        response = view_func(request, *args, **kwargs)
    File "/edx/app/edxapp/edx-platform/common/djangoapps/util/json_request.py", line 55, in parse_json_into_request
        return view_function(request, *args, **kwargs)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
        return view_func(request, *args, **kwargs)
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/views.py", line 936, in course_discussions_settings_handler
        course, discussion_settings
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/views.py", line 957, in get_divided_discussions
        all_discussions = utils.get_discussion_categories_ids(course, None, include_all=True)
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/django_comment_client/utils.py", line 485, in get_discussion_categories_ids
        xblock.discussion_id for xblock in get_accessible_discussion_xblocks(course, user, include_all=include_all)
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/django_comment_client/utils.py", line 146, in get_accessible_discussion_xblocks
        return get_accessible_discussion_xblocks_by_course_id(course.id, user, include_all=include_all)
    File "/edx/app/edxapp/edx-platform/openedx/core/lib/cache_utils.py", line 73, in decorator
        result = wrapped(*args, **kwargs)
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/django_comment_client/utils.py", line 159, in get_accessible_discussion_xblocks_by_course_id
        if has_required_keys(xblock) and (include_all or has_access(user, 'load', xblock, course_id))
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/access.py", line 158, in has_access
        return _has_access_descriptor(user, action, obj, course_key)
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/access.py", line 572, in _has_access_descriptor
        return _dispatch(checkers, action, user, descriptor)
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/access.py", line 669, in _dispatch
        result = table[action]()
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/access.py", line 543, in can_load
        group_access_response = _has_group_access(descriptor, user, course_key)
    File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/access.py", line 513, in _has_group_access
        user_fragment=partition.access_denied_fragment(descriptor, user, user_group, allowed_groups),
    File "/edx/app/edxapp/edx-platform/openedx/features/content_type_gating/partitions.py", line 98, in access_denied_fragment
        upgrade_price, _ = format_strikeout_price(user, course)
    File "/edx/app/edxapp/edx-platform/openedx/features/discounts/utils.py", line 22, in format_strikeout_price
        if can_receive_discount(user, course):
    File "/edx/app/edxapp/edx-platform/openedx/features/discounts/applicability.py", line 74, in can_receive_discount
        if CourseEnrollment.objects.filter(user=user).exclude(mode__in=CourseMode.UPSELL_TO_VERIFIED_MODES).exists():
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method
        return getattr(self.get_queryset(), name)(*args, **kwargs)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 787, in filter
        return self._filter_or_exclude(False, *args, **kwargs)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/query.py", line 805, in _filter_or_exclude
        clone.query.add_q(Q(*args, **kwargs))
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1250, in add_q
        clause, _ = self._add_q(q_object, self.used_aliases)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1276, in _add_q
        allow_joins=allow_joins, split_subq=split_subq,
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1206, in build_filter
        condition = lookup_class(lhs, value)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/lookups.py", line 24, in __init__
        self.rhs = self.get_prep_lookup()
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/fields/related_lookups.py", line 112, in get_prep_lookup
        self.rhs = target_field.get_prep_value(self.rhs)
    File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 966, in get_prep_value
        return int(value)
    TypeError: int() argument must be a string or a number, not 'AnonymousUser'

This is tracked in https://openedx.atlassian.net/browse/REV-988
[REV-988]
2019-10-10 10:53:26 -04:00
Awais Qureshi
4387f753d5 BOM-912
Can't convert 'bytes' object to str implicitly
2019-10-10 16:06:17 +05:00
Ayub
c5a61541ab Merge pull request #21949 from edx/BOM-894
BOM-894 python3 order mismatch
2019-10-10 10:22:57 +05:00
jinder1s
93dcd26118 quality fixes 2019-10-09 09:30:52 -04:00
jinder1s
d8b7a2e1fe quality fixes 2019-10-09 08:53:22 -04:00
jinder1s
075faede22 Modifying test to work in both py2 and 3 2019-10-09 08:53:22 -04:00
Manjinder Singh
00348ec0a9 Merge pull request #21898 from edx/msingh/python3_test_views_py
BOM-749: Explicity creating byte strings
2019-10-09 08:52:06 -04:00
aarif
91bed37922 Updated the expected error message to get assertion successful for both python versions
changes made as suggested
2019-10-09 16:03:50 +05:00
Aarif
6a2f3d6dbc Merge pull request #21866 from edx/BOM-831
Updated the string input to md5 to make output compatible with both python versions - BOM-831
2019-10-09 15:40:33 +05:00
Ayub khan
298fbdaec2 BOM-894 python3 order mismatch
Python3 arguments have different positions as compared to python2
2019-10-09 15:06:27 +05:00
Aarif
97452b31ae Merge pull request #21881 from edx/BOM-873
Updated the division operation to make the output compatible with both python versions - BOM-873
2019-10-08 13:41:15 +05:00
Braden MacDonald
b7d1827017 Fix minor unicode OLX bug 2019-10-07 16:43:47 -04:00
jinder1s
2c6b2f32dd converting unicode to byte where necessary 2019-10-04 11:13:11 -04:00
Calen Pennington
9a800fb180 Downgrade content-highlights mismatches to warnings, and add the course-key to the error message 2019-10-04 10:35:03 -04:00
asadazam93
7a43721f81 Upgrade python 3 decode error 2019-10-04 16:17:11 +05:00