Commit c72b0bb2 by Calen Pennington

Resolve merge conflicts relative to master

parent 155ffe37
......@@ -177,14 +177,9 @@ def xblock_view_handler(request, usage_key_string, view_name):
accept_header = request.META.get('HTTP_ACCEPT', 'application/json')
if 'application/json' in accept_header:
<<<<<<< HEAD
store = get_modulestore(usage_key)
component = store.get_item(usage_key)
=======
store = get_modulestore(old_location)
component = store.get_item(old_location)
is_read_only = _xblock_is_read_only(component)
>>>>>>> edx/master
# wrap the generated fragment in the xmodule_editor div so that the javascript
# can bind to it correctly
......@@ -215,12 +210,7 @@ def xblock_view_handler(request, usage_key_string, view_name):
html = render_to_string('container_xblock_component.html', {
'xblock_context': context,
'xblock': component,
<<<<<<< HEAD
'locator': usage_key,
'reordering_enabled': True,
=======
'locator': locator,
>>>>>>> edx/master
})
return JsonResponse({
'html': html,
......@@ -265,9 +255,6 @@ def xblock_view_handler(request, usage_key_string, view_name):
return HttpResponse(status=406)
<<<<<<< HEAD
def _save_item(request, usage_key, data=None, children=None, metadata=None, nullout=None,
=======
def _xblock_is_read_only(xblock):
"""
Returns true if the specified xblock is read-only, meaning that it cannot be edited.
......@@ -279,8 +266,7 @@ def _xblock_is_read_only(xblock):
return component_publish_state == PublishState.public
def _save_item(request, usage_loc, item_location, data=None, children=None, metadata=None, nullout=None,
>>>>>>> edx/master
def _save_item(request, usage_key, data=None, children=None, metadata=None, nullout=None,
grader_type=None, publish=None):
"""
Saves xblock w/ its fields. Has special processing for grader_type, publish, and nullout and Nones in metadata.
......
......@@ -53,8 +53,6 @@ class ContainerViewTestCase(CourseTestCase):
parent_location=published_xblock_with_child.location,
category="html", display_name="Child HTML"
)
<<<<<<< HEAD
draft_xblock_with_child = modulestore('draft').convert_to_draft(published_xblock_with_child.location)
expected_breadcrumbs = (
r'<a href="/unit/{unit_location}"\s*'
r'class="navigation-link navigation-parent">Unit</a>\s*'
......@@ -65,9 +63,6 @@ class ContainerViewTestCase(CourseTestCase):
unit_location=unicode(self.vertical.location).replace("+", "\\+"),
child_vertical_location=unicode(self.child_vertical.location).replace("+", "\\+"),
)
=======
branch_name = "MITx.999.Robot_Super_Course/branch/draft/block"
>>>>>>> edx/master
self._test_html_content(
published_xblock_with_child,
expected_location_in_section_tag=published_xblock_with_child.location,
......
......@@ -24,13 +24,8 @@ class TabsPageTests(CourseTestCase):
self.url = reverse_course_url('tabs_handler', self.course.id)
# add a static tab to the course, for code coverage
<<<<<<< HEAD
ItemFactory.create(
parent_location=self.course.location,
=======
self.test_tab = ItemFactory.create(
parent_location=self.course_location,
>>>>>>> edx/master
parent_location=self.course.location,
category="static_tab",
display_name="Static_1"
)
......
......@@ -147,11 +147,7 @@ class DraftModuleStore(MongoModuleStore):
self.refresh_cached_metadata_inheritance_tree(draft_location.course_key)
<<<<<<< HEAD
return self._load_items(source_location.course_key, [original])[0]
=======
return wrap_draft(self._load_items([original])[0])
>>>>>>> edx/master
return wrap_draft(self._load_items(source_location.course_key, [original])[0])
def update_item(self, xblock, user_id=None, allow_not_found=False, force=False):
"""
......
......@@ -38,20 +38,11 @@ class Command(BaseCommand):
def _ended_courses(self):
for course_id in [course # all courses in COURSE_LISTINGS
<<<<<<< HEAD
for sub in settings.COURSE_LISTINGS
for course in settings.COURSE_LISTINGS[sub]]:
for sub in settings.COURSE_LISTINGS
for course in settings.COURSE_LISTINGS[sub]]:
course = modulestore().get_course(course_id)
if course.has_ended():
yield course_id
=======
for sub in settings.COURSE_LISTINGS
for course in settings.COURSE_LISTINGS[sub]]:
course_loc = CourseDescriptor.id_to_location(course_id)
course = modulestore().get_instance(course_id, course_loc)
if course.has_ended():
yield course_id
>>>>>>> edx/master
def handle(self, *args, **options):
......
......@@ -229,16 +229,10 @@ class XQueueCertInterface(object):
contents = {
'action': 'create',
'username': student.username,
<<<<<<< HEAD
'course_id': course_id.to_deprecated_string(),
'name': profile.name,
'grade': grade['grade'],
=======
'course_id': course_id,
'course_name': course_name,
'name': profile_name,
'grade': grade_contents,
>>>>>>> edx/master
'template_pdf': template_pdf,
}
if template_file:
......
......@@ -5,19 +5,14 @@ import logging
from django.contrib.auth.models import User
from django.http import HttpResponse
<<<<<<< HEAD
import json
from dogapi import dog_stats_api
from xmodule.modulestore.locations import SlashSeparatedCourseKey
=======
from django.views.decorators.csrf import csrf_exempt
>>>>>>> edx/master
from capa.xqueue_interface import XQUEUE_METRIC_NAME
from certificates.models import certificate_status_for_student, CertificateStatuses, GeneratedCertificate
from certificates.queue import XQueueCertInterface
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.locations import SlashSeparatedCourseKey
logger = logging.getLogger(__name__)
......
......@@ -233,18 +233,10 @@ def get_module_system_for_user(user, field_data_cache,
to allow an existing module to be re-bound to a user. Most of the user bindings happen when creating the
closures that feed the instantiation of ModuleSystem.
<<<<<<< HEAD
# Do not check access when it's a noauth request.
if getattr(user, 'known', True):
# Short circuit--if the user shouldn't have access, bail without doing any work
if not has_access(user, 'load', descriptor, course_id):
return None
=======
The arguments fall into two categories: those that have explicit or implicit user binding, which are user
and field_data_cache, and those don't and are just present so that ModuleSystem can be instantiated, which
are all the other arguments. Ultimately, this isn't too different than how get_module_for_descriptor_internal
was before refactoring.
>>>>>>> edx/master
Arguments:
see arguments for get_module()
......
......@@ -577,11 +577,7 @@ class ViewInStudioTest(ModuleStoreTestCase):
location = course_key.make_usage_key('chapter', 'Overview')
descriptor = modulestore().get_item(location)
<<<<<<< HEAD
self._get_module(course_key, descriptor, location)
=======
self.module = self._get_module(course_id, descriptor, location)
>>>>>>> edx/master
self.module = self._get_module(course_key, descriptor, location)
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
......
......@@ -1066,14 +1066,11 @@ def send_email(request, course_id):
- 'subject' specifies email's subject
- 'message' specifies email's content
"""
<<<<<<< HEAD
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
=======
if not bulk_email_is_enabled_for_course(course_id):
return HttpResponseForbidden("Email is not enabled for this course.")
>>>>>>> edx/master
send_to = request.POST.get("send_to")
subject = request.POST.get("subject")
message = request.POST.get("message")
......
......@@ -26,12 +26,8 @@ from student.models import CourseEnrollment
from bulk_email.models import CourseAuthorization
from class_dashboard.dashboard_data import get_section_display_name, get_array_section_has_problem
<<<<<<< HEAD
from .tools import get_units_with_due_date, title_or_url
from xmodule.modulestore.locations import SlashSeparatedCourseKey
=======
from .tools import get_units_with_due_date, title_or_url, bulk_email_is_enabled_for_course
>>>>>>> edx/master
from xmodule.modulestore.locations import SlashSeparatedCourseKey
@ensure_csrf_cookie
......@@ -66,14 +62,8 @@ def instructor_dashboard_2(request, course_id):
sections.insert(3, _section_extensions(course))
# Gate access to course email by feature flag & by course-specific authorization
<<<<<<< HEAD
if settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and \
is_studio_course and CourseAuthorization.instructor_email_enabled(course_key):
if bulk_email_is_enabled_for_course(course_key):
sections.append(_section_send_email(course_key, access, course))
=======
if bulk_email_is_enabled_for_course(course_id):
sections.append(_section_send_email(course_id, access, course))
>>>>>>> edx/master
# Gate access to Metrics tab by featue flag and staff authorization
if settings.FEATURES['CLASS_DASHBOARD'] and access['staff']:
......
......@@ -844,40 +844,23 @@ def instructor_dashboard(request, course_id):
email_subject = request.POST.get("subject")
html_message = request.POST.get("message")
<<<<<<< HEAD
try:
# Create the CourseEmail object. This is saved immediately, so that
# any transaction that has been pending up to this point will also be
# committed.
email = CourseEmail.create(
course_key.to_deprecated_string(), request.user, email_to_option, email_subject, html_message
)
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
submit_bulk_course_email(request, course_key, email.id) # pylint: disable=E1101
except Exception as err: # pylint: disable=broad-except
# Catch any errors and deliver a message to the user
error_msg = "Failed to send email! ({0})".format(err)
msg += "<font color='red'>" + error_msg + "</font>"
log.exception(error_msg)
=======
if bulk_email_is_enabled_for_course(course_id):
if bulk_email_is_enabled_for_course(course_key):
try:
# Create the CourseEmail object. This is saved immediately, so that
# any transaction that has been pending up to this point will also be
# committed.
email = CourseEmail.create(course_id, request.user, email_to_option, email_subject, html_message)
email = CourseEmail.create(
course_key.to_deprecated_string(), request.user, email_to_option, email_subject, html_message
)
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
submit_bulk_course_email(request, course_id, email.id) # pylint: disable=E1101
submit_bulk_course_email(request, course_key, email.id) # pylint: disable=E1101
except Exception as err:
except Exception as err: # pylint: disable=broad-except
# Catch any errors and deliver a message to the user
error_msg = "Failed to send email! ({0})".format(err)
msg += "<font color='red'>" + error_msg + "</font>"
log.exception(error_msg)
>>>>>>> edx/master
else:
# If sending the task succeeds, deliver a success message to the user.
......@@ -1005,12 +988,7 @@ def instructor_dashboard(request, course_id):
# 1. Feature flag is on
# 2. We have explicitly enabled email for the given course via django-admin
# 3. It is NOT an XML course
<<<<<<< HEAD
if settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and \
CourseAuthorization.instructor_email_enabled(course_key) and is_studio_course:
=======
if bulk_email_is_enabled_for_course(course_id):
>>>>>>> edx/master
if bulk_email_is_enabled_for_course(course_key):
show_email_tab = True
# display course stats only if there is no other table to display:
......
......@@ -353,13 +353,8 @@ class CertificateItemTest(ModuleStoreTestCase):
cart = Order.get_cart_for_user(user=self.user)
CertificateItem.add_to_order(cart, self.course_key, self.cost, 'verified')
# verify that we are still enrolled
<<<<<<< HEAD
self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course_key))
self.mock_server_track.reset_mock()
=======
self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course_id))
self.mock_tracker.reset_mock()
>>>>>>> edx/master
cart.purchase()
enrollment = CourseEnrollment.objects.get(user=self.user, course_id=self.course_key)
self.assertEquals(enrollment.mode, u'verified')
......@@ -460,13 +455,8 @@ class CertificateItemTest(ModuleStoreTestCase):
cart.purchase()
with patch('shoppingcart.models.send_mail', side_effect=smtplib.SMTPException):
<<<<<<< HEAD
CourseEnrollment.unenroll(self.user, course_key)
self.assertTrue(error_logger.called)
=======
CourseEnrollment.unenroll(self.user, course_id)
self.assertTrue(error_logger.call_args[0][0].startswith('Failed sending email'))
>>>>>>> edx/master
def test_refund_cert_callback_after_expiration(self):
# If the expiration date has passed, the user cannot get a refund
......
......@@ -121,7 +121,10 @@ class VerifiedView(View):
if CourseEnrollment.enrollment_mode_for_user(request.user, course_id) == 'verified':
return redirect(reverse('dashboard'))
verify_mode = CourseMode.mode_for_course(course_id, "verified")
<<<<<<< HEAD
if verify_mode is None:
return redirect(reverse('dashboard'))
chosen_price = request.session.get(
"donation_for_course",
{}
......@@ -129,14 +132,6 @@ class VerifiedView(View):
course_id.to_deprecated_string(),
verify_mode.min_price
)
=======
if verify_mode is None:
return redirect(reverse('dashboard'))
if course_id in request.session.get("donation_for_course", {}):
chosen_price = request.session["donation_for_course"][course_id]
else:
chosen_price = verify_mode.min_price.format("{:g}")
>>>>>>> edx/master
course = course_from_id(course_id)
context = {
......@@ -276,10 +271,7 @@ def results_callback(request):
# If this is a reverification, log an event
if attempt.window:
course_id = attempt.window.course_id
<<<<<<< HEAD
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
=======
>>>>>>> edx/master
course = course_from_id(course_id)
course_enrollment = CourseEnrollment.get_or_create_enrollment(attempt.user, course_id)
course_enrollment.emit_event(EVENT_NAME_USER_REVERIFICATION_REVIEWED_BY_SOFTWARESECURE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment