Skip to content

Commit

Permalink
RED-1498: Merge branch 'open-release/juniper.master' into omar/junipe…
Browse files Browse the repository at this point in the history
…r-4of4

This fully merges appsembler/tahoe/develop (hawthorn) with
open-release/juniper.master from upstream
  • Loading branch information
OmarIthawi committed Oct 29, 2020
2 parents 2b0dd82 + 089f03c commit 0922a61
Show file tree
Hide file tree
Showing 1,818 changed files with 147,447 additions and 127,715 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ omit =

concurrency=multiprocessing
parallel = true
relative_files = true

[report]
ignore_errors = True
Expand Down
18 changes: 0 additions & 18 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# and so should not be destroyed by "make clean".
# start-noclean
requirements/private.txt
requirements/edx/private.in
requirements/edx/private.txt
lms/envs/private.py
cms/envs/private.py
# end-noclean
Expand Down
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: python
python:
- "2.7"
- "3.5"

services:
- mongodb
Expand All @@ -27,11 +27,11 @@ env:
- TRAVIS_FIXES="pip install -r requirements/edx/local.in"
jobs:
- TOXENV=pep8
- TOXENV=py27-common
- TOXENV=py27-lms-1
- TOXENV=py27-lms-2
- TOXENV=py27-mte
- TOXENV=py27-studio
- TOXENV=common
- TOXENV=lms-1
- TOXENV=lms-2
- TOXENV=mte
- TOXENV=studio

script:
- tox $ARGS
Expand Down
12 changes: 12 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,15 @@ file_filter = conf/locale/<lang>/LC_MESSAGES/edx_proctoring_proctortrack.po
source_file = conf/locale/en/LC_MESSAGES/edx_proctoring_proctortrack.po
source_lang = en
type = PO

[open-edx-releases.release-juniper]
file_filter = conf/locale/<lang>/LC_MESSAGES/django.po
source_file = conf/locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO

[open-edx-releases.release-juniper-js]
file_filter = conf/locale/<lang>/LC_MESSAGES/djangojs.po
source_file = conf/locale/en/LC_MESSAGES/djangojs.po
source_lang = en
type = PO
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ pull_translations: ## pull translations from Transifex
git clean -fdX conf/locale/rtl
git clean -fdX conf/locale/eo
i18n_tool validate
paver i18n_compilejs


detect_changed_source_translations: ## check if translation files are up-to-date
i18n_tool changed
Expand All @@ -59,7 +61,8 @@ pull: ## update the Docker image used by "make shell"
docker pull edxops/edxapp:latest

requirements: ## install development environment requirements
pip install -qr requirements/edx/development.txt --exists-action w
pip install -qr requirements/edx/pip-tools.txt
pip-sync -q requirements/edx/development.txt requirements/edx/private.*

shell: ## launch a bash shell in a Docker container with all edx-platform dependencies installed
docker run -it -e "NO_PYTHON_UNINSTALL=1" -e "PIP_INDEX_URL=https://pypi.python.org/simple" -e TERM \
Expand All @@ -83,16 +86,19 @@ REQ_FILES = \
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the pip requirements files to use the latest releases satisfying our constraints
pip install -qr requirements/edx/pip-tools.txt
@for f in $(REQ_FILES); do \
@ export REBUILD='--rebuild'; \
for f in $(REQ_FILES); do \
echo ; \
echo "== $$f ===============================" ; \
pip-compile -v --no-emit-trusted-host --no-index --rebuild --upgrade -o $$f.txt $$f.in || exit 1; \
echo "pip-compile -v --no-emit-trusted-host --no-index $$REBUILD --upgrade -o $$f.txt $$f.in"; \
pip-compile -v --no-emit-trusted-host --no-index $$REBUILD --upgrade -o $$f.txt $$f.in || exit 1; \
export REBUILD=''; \
done
# Post process all of the files generated above to work around open pip-tools issues
scripts/post-pip-compile.sh $(REQ_FILES:=.txt)
# Let tox control the Django version & django-oauth-toolkit version for tests
grep -e "^django==" -e "^django-oauth-toolkit==" requirements/edx/base.txt > requirements/edx/django.txt
sed '/^[dD]jango==/d;/^django-oauth-toolkit==/d' requirements/edx/testing.txt > requirements/edx/testing.tmp
# Let tox control the Django version for tests
grep -e "^django==" requirements/edx/base.txt > requirements/edx/django.txt
sed '/^[dD]jango==/d' requirements/edx/testing.txt > requirements/edx/testing.tmp
mv requirements/edx/testing.tmp requirements/edx/testing.txt

.PHONY: docker-tox
Expand Down
9 changes: 7 additions & 2 deletions cms/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

import importlib
import os
import logging
import contracts
import pytest

from openedx.core.pytest_hooks import pytest_json_modifyreport # pylint: disable=unused-import
from openedx.core.pytest_hooks import pytest_sessionfinish # pylint: disable=unused-import
from openedx.core.pytest_hooks import DeferPlugin


# Patch the xml libs before anything else.
Expand All @@ -25,6 +25,11 @@ def pytest_configure(config):
"""
Do core setup operations from manage.py before collecting tests.
"""
if config.pluginmanager.hasplugin("pytest_jsonreport") or config.pluginmanager.hasplugin("json-report"):
config.pluginmanager.register(DeferPlugin())
else:
logging.info("pytest did not register json_report correctly")

if config.getoption('help'):
return
enable_contracts = os.environ.get('ENABLE_CONTRACTS', False)
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/api/v1/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
app_name = 'cms.djangoapps.api.v1'

router = DefaultRouter()
router.register(r'course_runs', CourseRunViewSet, base_name='course_run')
router.register(r'course_runs', CourseRunViewSet, basename='course_run')
urlpatterns = router.urls
8 changes: 4 additions & 4 deletions cms/djangoapps/api/v1/views/course_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from opaque_keys.edx.keys import CourseKey
from rest_framework import parsers, permissions, status, viewsets
from rest_framework.authentication import SessionAuthentication
from rest_framework.decorators import detail_route
from rest_framework.decorators import action
from rest_framework.response import Response

from contentstore.views.course import _accessible_courses_iter, get_course_and_check_access
Expand All @@ -20,7 +20,6 @@
)


# pylint: disable=unused-argument
class CourseRunViewSet(viewsets.GenericViewSet):
authentication_classes = (JwtAuthentication, SessionAuthentication,)
lookup_value_regex = settings.COURSE_KEY_REGEX
Expand Down Expand Up @@ -74,7 +73,8 @@ def create(self, request, *args, **kwargs):
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)

@detail_route(
@action(
detail=True,
methods=['post', 'put'],
parser_classes=(parsers.FormParser, parsers.MultiPartParser,),
serializer_class=CourseRunImageSerializer)
Expand All @@ -85,7 +85,7 @@ def images(self, request, *args, **kwargs):
serializer.save()
return Response(serializer.data)

@detail_route(methods=['post'])
@action(detail=True, methods=['post'])
def rerun(self, request, *args, **kwargs):
course_run = self.get_object()
serializer = CourseRunRerunSerializer(course_run, data=request.data, context=self.get_serializer_context())
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/cms_user_tasks/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def ready(self):
"""
Connect signal handlers.
"""
from . import signals # pylint: disable=unused-variable
from . import signals # pylint: disable=unused-import
2 changes: 1 addition & 1 deletion cms/djangoapps/cms_user_tasks/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from user_tasks.models import UserTaskArtifact
from user_tasks.signals import user_task_stopped

from six.moves.urllib.parse import urljoin # pylint: disable=import-error
from six.moves.urllib.parse import urljoin

from .tasks import send_task_complete_email

Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/api/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""


from django.core.urlresolvers import reverse
from django.urls import reverse
from rest_framework.test import APITestCase

from lms.djangoapps.courseware.tests.factories import StaffFactory
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/api/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from datetime import datetime

from django.core.urlresolvers import reverse
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase

Expand Down
3 changes: 0 additions & 3 deletions cms/djangoapps/contentstore/api/views/course_quality.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# pylint: disable=missing-docstring


import logging
import time

Expand Down
3 changes: 0 additions & 3 deletions cms/djangoapps/contentstore/api/views/course_validation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# pylint: disable=missing-docstring


import logging

import dateutil
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def ready(self):
"""
# Can't import models at module level in AppConfigs, and models get
# included from the signal handlers
from .signals import handlers # pylint: disable=unused-variable
from .signals import handlers # pylint: disable=unused-import
42 changes: 23 additions & 19 deletions cms/djangoapps/contentstore/course_info_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,26 @@ def update_course_updates(location, update, passed_id=None, user=None):
course_updates = modulestore().create_item(user.id, location.course_key, location.block_type, location.block_id)

course_update_items = list(reversed(get_course_update_items(course_updates)))
course_update_dict = None

if passed_id is not None:
passed_index = _get_index(passed_id)
# oldest update at start of list
if 0 < passed_index <= len(course_update_items):
course_update_dict = course_update_items[passed_index - 1]
course_update_dict["date"] = update["date"]
course_update_dict["content"] = update["content"]
course_update_items[passed_index - 1] = course_update_dict
else:

# if passed_index in course_update_items_ids:
for course_update_item in course_update_items:
if course_update_item["id"] == passed_index:
course_update_dict = course_update_item
course_update_item["date"] = update["date"]
course_update_item["content"] = update["content"]
break
if course_update_dict is None:
return HttpResponseBadRequest(_("Invalid course update id."))
else:
course_update_items_ids = [course_update_item['id'] for course_update_item in course_update_items]

course_update_dict = {
"id": len(course_update_items) + 1,
# if no course updates then the id will be 1 otherwise maxid + 1
"id": max(course_update_items_ids) + 1 if course_update_items_ids else 1,
"date": update["date"],
"content": update["content"],
"status": CourseInfoBlock.STATUS_VISIBLE
Expand Down Expand Up @@ -131,17 +137,15 @@ def delete_course_update(location, update, passed_id, user):
passed_index = _get_index(passed_id)

# delete update item from given index
if 0 < passed_index <= len(course_update_items):
course_update_item = course_update_items[passed_index - 1]
# soft delete course update item
course_update_item["status"] = CourseInfoBlock.STATUS_DELETED
course_update_items[passed_index - 1] = course_update_item

# update db record
save_course_update_items(location, course_updates, course_update_items, user)
return _get_visible_update(course_update_items)
else:
return HttpResponseBadRequest(_("Invalid course update id."))
for course_update_item in course_update_items:
if course_update_item["id"] == passed_index:
# soft delete course update item
course_update_item["status"] = CourseInfoBlock.STATUS_DELETED
# update db record
save_course_update_items(location, course_updates, course_update_items, user)
return _get_visible_update(course_update_items)

return HttpResponseBadRequest(_("Invalid course update id."))


def _get_index(passed_id=None):
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/courseware_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
from django.urls import resolve
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from eventtracking import tracker
from search.search_engine_base import SearchEngine
from six import add_metaclass, string_types, text_type

from contentstore.course_group_config import GroupConfiguration
from course_modes.models import CourseMode
from eventtracking import tracker
from openedx.core.lib.courses import course_image_url
from xmodule.annotator_mixin import html_to_text
from xmodule.library_tools import normalize_key_for_search
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/git_export_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django.contrib.auth.models import User
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from six.moves.urllib.parse import urlparse # pylint: disable=import-error
from six.moves.urllib.parse import urlparse

from xmodule.contentstore.django import contentstore
from xmodule.modulestore.django import modulestore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def handle(self, *args, **options):

export_course_to_tarfile(course_key, filename)

results = self._get_results(filename) if pipe_results else None
results = self._get_results(filename) if pipe_results else ''

self.stdout.write(results, ending="")

Expand Down
Loading

0 comments on commit 0922a61

Please sign in to comment.