def __init__(self, request=None): # Get basic auth (username/password) for # xqueue connection if it's in the settings if settings.XQUEUE_INTERFACE.get('basic_auth') is not None: requests_auth = HTTPBasicAuth( *settings.XQUEUE_INTERFACE['basic_auth']) else: requests_auth = None if request is None: factory = RequestFactory() self.request = factory.get('/') else: self.request = request self.xqueue_interface = XQueueInterface( settings.XQUEUE_INTERFACE['url'], settings.XQUEUE_INTERFACE['django_auth'], requests_auth, ) self.whitelist = CertificateWhitelist.objects.all() self.restricted = UserProfile.objects.filter(allow_certificate=False) self.use_https = True
def __init__(self, request=None): # MakoMiddleware Note: # Line below has the side-effect of writing to a module level lookup # table that will allow problems to render themselves. If this is not # present, problems that a student hasn't seen will error when loading, # causing the grading system to under-count the possible score and # inflate their grade. This dependency is bad and was probably recently # introduced. This is the bandage until we can trace the root cause. m = MakoMiddleware() # Get basic auth (username/password) for # xqueue connection if it's in the settings if settings.XQUEUE_INTERFACE.get('basic_auth') is not None: requests_auth = HTTPBasicAuth( *settings.XQUEUE_INTERFACE['basic_auth']) else: requests_auth = None if request is None: factory = RequestFactory() self.request = factory.get('/') else: self.request = request self.xqueue_interface = XQueueInterface( settings.XQUEUE_INTERFACE['url'], settings.XQUEUE_INTERFACE['django_auth'], requests_auth, ) self.whitelist = CertificateWhitelist.objects.all() self.restricted = UserProfile.objects.filter(allow_certificate=False)
from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.x_module import XModuleDescriptor from .field_overrides import OverrideFieldData log = logging.getLogger(__name__) if settings.XQUEUE_INTERFACE.get('basic_auth') is not None: REQUESTS_AUTH = HTTPBasicAuth(*settings.XQUEUE_INTERFACE['basic_auth']) else: REQUESTS_AUTH = None XQUEUE_INTERFACE = XQueueInterface( settings.XQUEUE_INTERFACE['url'], settings.XQUEUE_INTERFACE['django_auth'], REQUESTS_AUTH, ) # TODO: course_id and course_key are used interchangeably in this file, which is wrong. # Some brave person should make the variable names consistently someday, but the code's # coupled enough that it's kind of tricky--you've been warned! class LmsModuleRenderError(Exception): """ An exception class for exceptions thrown by module_render that don't fit well elsewhere """ pass
from xmodule_modifiers import replace_course_urls, replace_static_urls, add_histogram, wrap_xmodule from .model_data import LmsKeyValueStore, LmsUsage, ModelDataCache from xmodule.modulestore.exceptions import ItemNotFoundError from statsd import statsd log = logging.getLogger(__name__) if settings.XQUEUE_INTERFACE.get('basic_auth') is not None: requests_auth = HTTPBasicAuth(*settings.XQUEUE_INTERFACE['basic_auth']) else: requests_auth = None xqueue_interface = XQueueInterface( settings.XQUEUE_INTERFACE['url'], settings.XQUEUE_INTERFACE['django_auth'], requests_auth, ) def make_track_function(request): ''' Make a tracking function that logs what happened. For use in ModuleSystem. ''' import track.views def f(event_type, event): return track.views.server_track(request, event_type, event,