diff --git a/common/djangoapps/track/views/__init__.py b/common/djangoapps/track/views/__init__.py index b5cf9ce881..eca17f5227 100644 --- a/common/djangoapps/track/views/__init__.py +++ b/common/djangoapps/track/views/__init__.py @@ -96,6 +96,8 @@ def server_track(request, event_type, event, page=None): except: username = "anonymous" + host_header = 'HTTP_HOST' if request is not None and 'HTTP_HOST' in request.META else 'SERVER_NAME' + # define output: event = { "username": username, @@ -108,7 +110,7 @@ def server_track(request, event_type, event, page=None): "agent": _get_request_header(request, 'HTTP_USER_AGENT').decode('latin1'), "page": page, "time": datetime.datetime.utcnow().replace(tzinfo=pytz.utc), - "host": _get_request_header(request, 'SERVER_NAME'), + "host": _get_request_header(request, host_header), "context": eventtracker.get_tracker().resolve_context(), } diff --git a/common/djangoapps/util/views.py b/common/djangoapps/util/views.py index d19305a222..13b02715db 100644 --- a/common/djangoapps/util/views.py +++ b/common/djangoapps/util/views.py @@ -388,6 +388,8 @@ def get_feedback_form_context(request): context["additional_info"] = {} + host_header = 'HTTP_HOST' if request is not None and 'HTTP_HOST' in request.META else 'SERVER_NAME' + if request.user.is_authenticated: context["realname"] = request.user.profile.name context["email"] = request.user.email @@ -397,7 +399,7 @@ def get_feedback_form_context(request): context["email"] = request.POST["email"] for header, pretty in [("HTTP_REFERER", "Page"), ("HTTP_USER_AGENT", "Browser"), ("REMOTE_ADDR", "Client IP"), - ("SERVER_NAME", "Host")]: + (host_header, "Host")]: context["additional_info"][pretty] = request.META.get(header) context["support_email"] = configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL) diff --git a/lms/djangoapps/dashboard/sysadmin.py b/lms/djangoapps/dashboard/sysadmin.py index e348e3db6a..95d2c4618f 100644 --- a/lms/djangoapps/dashboard/sysadmin.py +++ b/lms/djangoapps/dashboard/sysadmin.py @@ -296,12 +296,14 @@ class Users(SysadminDashboardView): action = request.POST.get('action', '') track.views.server_track(request, action, {}, page='user_sysdashboard') + host_header = 'HTTP_HOST' if request is not None and 'HTTP_HOST' in request.META else 'SERVER_NAME' + if action == 'download_users': header = [_('username'), _('email'), ] data = ([u.username, u.email] for u in (User.objects.all().iterator())) return self.return_csv('users_{0}.csv'.format( - request.META['SERVER_NAME']), header, data) + request.META[host_header]), header, data) elif action == 'repair_eamap': self.msg = u'
{1}{2}'.format(
_('Repair Results'),
@@ -552,6 +554,8 @@ class Staffing(SysadminDashboardView):
track.views.server_track(request, action, {},
page='staffing_sysdashboard')
+ host_header = 'HTTP_HOST' if request is not None and 'HTTP_HOST' in request.META else 'SERVER_NAME'
+
if action == 'get_staff_csv':
data = []
roles = [CourseInstructorRole, CourseStaffRole, ]
@@ -566,7 +570,7 @@ class Staffing(SysadminDashboardView):
_('role'), _('username'),
_('email'), _('full_name'), ]
return self.return_csv('staff_{0}.csv'.format(
- request.META['SERVER_NAME']), header, data)
+ request.META[host_header]), header, data)
return self.get(request)
diff --git a/lms/djangoapps/instructor_task/api_helper.py b/lms/djangoapps/instructor_task/api_helper.py
index 1504ef747d..19b4ff9316 100644
--- a/lms/djangoapps/instructor_task/api_helper.py
+++ b/lms/djangoapps/instructor_task/api_helper.py
@@ -135,11 +135,13 @@ def _get_xmodule_instance_args(request, task_id):
permit old-style xqueue callbacks directly to the appropriate module in the LMS.
The `task_id` is also passed to the tracking log function.
"""
+ host_header = 'HTTP_HOST' if request is not None and 'HTTP_HOST' in request.META else 'SERVER_NAME'
+
request_info = {'username': request.user.username,
'user_id': request.user.id,
'ip': request.META['REMOTE_ADDR'],
'agent': request.META.get('HTTP_USER_AGENT', '').decode('latin1'),
- 'host': request.META['SERVER_NAME'],
+ 'host': request.META[host_header],
}
xmodule_instance_args = {'xqueue_callback_url_prefix': get_xqueue_callback_url_prefix(request),
diff --git a/requirements/edx-sandbox/base.txt b/requirements/edx-sandbox/base.txt
index b12d655007..0b26d8694c 100644
--- a/requirements/edx-sandbox/base.txt
+++ b/requirements/edx-sandbox/base.txt
@@ -25,7 +25,7 @@ nose==1.3.7 # via matplotlib
numpy==1.6.2
pycparser==2.19
pyparsing==2.2.0
-python-dateutil==2.7.3 # via matplotlib
+python-dateutil==2.7.5 # via matplotlib
scipy==0.14.0
singledispatch==3.4.0.3 # via tornado
six==1.11.0
diff --git a/requirements/edx/base.in b/requirements/edx/base.in
index ebe071b423..e800204df8 100644
--- a/requirements/edx/base.in
+++ b/requirements/edx/base.in
@@ -24,6 +24,7 @@
# as development.in or testing.in instead.
analytics-python==1.1.0 # Used for Segment analytics
+aniso8601==3.0.2 # via tincan
attrs # Reduces boilerplate code involving class attributes
Babel==1.3 # Internationalization utilities, used for date formatting in a few places
bleach==1.4 # Allowed-list-based HTML sanitizing library that escapes or strips markup and attributes; used for capa and LTI
@@ -92,7 +93,7 @@ fs==2.0.18
fs-s3fs==0.1.8
futures ; python_version == "2.7" # via django-pipeline, python-swift-client, s3transfer
glob2==0.3 # Enhanced glob module, used in openedx.core.lib.rooted_paths
-gunicorn==17.5
+gunicorn==19.0
help-tokens
html5lib==0.999 # HTML parser, used for capa problems
ipaddr==2.1.11 # Ip network support for Embargo feature
@@ -128,8 +129,8 @@ pyuca==1.1 # For more accurate sorting of translated co
reportlab # Used for shopping cart's pdf invoice/receipt generation
rest-condition # DRF's recommendation for supporting complex permissions
rfc6266-parser # Used to generate Content-Disposition headers.
-social-auth-app-django
-social-auth-core
+social-auth-app-django==2.1.0
+social-auth-core==1.7.0
pysrt==0.4.7 # Support for SubRip subtitle files, used in the video XModule
pytz==2016.10 # Time zone information database
PyYAML # Used to parse XModule resource templates
diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt
index 54110978ae..ecbcd570c7 100644
--- a/requirements/edx/base.txt
+++ b/requirements/edx/base.txt
@@ -41,7 +41,7 @@ git+https://github.com/open-craft/xblock-poll@add89e14558c30f3c8dc7431e5cd6536ff
-e common/lib/xmodule
amqp==1.4.9 # via kombu
analytics-python==1.1.0
-aniso8601==3.0.2 # via tincan
+aniso8601==3.0.2
anyjson==0.3.3 # via kombu
appdirs==1.4.3 # via fs
argh==0.26.2
@@ -94,7 +94,7 @@ django-require==1.0.11
django-rest-swagger==2.2.0
django-sekizai==0.10.0
django-ses==0.8.4
-django-simple-history==2.4.0
+django-simple-history==2.5.1
django-splash==0.2.2
django-statici18n==1.4.0
django-storages==1.4.1
@@ -126,7 +126,7 @@ edx-oauth2-provider==1.2.2
edx-opaque-keys[django]==0.4.4
edx-organizations==1.0.0
edx-proctoring==1.4.0
-edx-rest-api-client==1.8.2
+edx-rest-api-client==1.9
edx-search==1.2.1
edx-submissions==2.0.12
edx-user-state-client==1.0.4
@@ -138,10 +138,10 @@ feedparser==5.1.3
firebase-token-generator==1.3.2
fs-s3fs==0.1.8
fs==2.0.18
-future==0.16.0 # via pyjwkest
+future==0.17.0 # via pyjwkest
futures==3.2.0 ; python_version == "2.7"
glob2==0.3
-gunicorn==17.5
+gunicorn==19.0
hash-ring==1.3.1 # via django-memcached-hashring
help-tokens==1.0.3
html5lib==0.999
@@ -180,7 +180,7 @@ openapi-codec==1.3.2 # via django-rest-swagger
path.py==8.2.1
pathtools==0.1.2
paver==1.3.4
-pbr==5.0.0
+pbr==5.1.0
pdfminer==20140328
piexif==1.0.2
pillow==5.3.0
@@ -211,7 +211,7 @@ pyyaml==3.13
redis==2.10.6
reportlab==3.5.9
requests-oauthlib==1.0.0
-requests==2.19.1
+requests==2.20.0
rest-condition==1.0.3
rfc6266-parser==0.0.5.post2
rules==2.0
diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt
index 2aa0f91fd4..4b5d8d54b8 100644
--- a/requirements/edx/development.txt
+++ b/requirements/edx/development.txt
@@ -113,7 +113,7 @@ django-require==1.0.11
django-rest-swagger==2.2.0
django-sekizai==0.10.0
django-ses==0.8.4
-django-simple-history==2.4.0
+django-simple-history==2.5.1
django-splash==0.2.2
django-statici18n==1.4.0
django-storages==1.4.1
@@ -146,7 +146,7 @@ edx-oauth2-provider==1.2.2
edx-opaque-keys[django]==0.4.4
edx-organizations==1.0.0
edx-proctoring==1.4.0
-edx-rest-api-client==1.8.2
+edx-rest-api-client==1.9
edx-search==1.2.1
edx-sphinx-theme==1.3.0
edx-submissions==2.0.12
@@ -171,11 +171,11 @@ fs-s3fs==0.1.8
fs==2.0.18
funcsigs==1.0.2
functools32==3.2.3.post2
-future==0.16.0
+future==0.17.0
futures==3.2.0 ; python_version == "2.7"
fuzzywuzzy==0.17.0
glob2==0.3
-gunicorn==17.5
+gunicorn==19.0
hash-ring==1.3.1
help-tokens==1.0.3
html5lib==0.999
@@ -189,7 +189,7 @@ ipaddr==2.1.11
ipaddress==1.0.22
isodate==0.6.0
isort==4.3.4
-itsdangerous==0.24
+itsdangerous==1.1.0
itypes==1.1.0
jinja2-pluralize==0.3.0
jinja2==2.10
@@ -227,11 +227,11 @@ oauthlib==2.1.0
openapi-codec==1.3.2
pa11ycrawler==1.6.2
packaging==18.0 # via sphinx
-parsel==1.5.0
+parsel==1.5.1
path.py==8.2.1
pathtools==0.1.2
paver==1.3.4
-pbr==5.0.0
+pbr==5.1.0
pdfminer==20140328
piexif==1.0.2
pillow==5.3.0
@@ -271,7 +271,7 @@ pytest-cov==2.5.1
pytest-django==3.1.2
pytest-forked==0.2
pytest-randomly==1.2.3
-pytest-xdist==1.23.2
+pytest-xdist==1.24.0
pytest==3.6.3
python-dateutil==2.4.0
python-levenshtein==0.12.0
@@ -290,7 +290,7 @@ radon==2.4.0
redis==2.10.6
reportlab==3.5.9
requests-oauthlib==1.0.0
-requests==2.19.1
+requests==2.20.0
rest-condition==1.0.3
rfc6266-parser==0.0.5.post2
rules==2.0
@@ -326,7 +326,7 @@ text-unidecode==1.2
tincan==0.0.5
toml==0.10.0
tox-battery==0.5.1
-tox==3.5.2
+tox==3.5.3
traceback2==1.4.0
transifex-client==0.13.5
twisted==16.6.0
@@ -340,7 +340,7 @@ urlobject==2.4.3
user-util==0.1.5
virtualenv==16.0.0
voluptuous==0.11.5
-vulture==0.29
+vulture==1.0
w3lib==1.19.0
watchdog==0.9.0
web-fragments==0.2.2
@@ -352,4 +352,4 @@ xblock-utils==1.2.0
xblock==1.2.2
xmltodict==0.11.0
zendesk==1.1.1
-zope.interface==4.5.0
+zope.interface==4.6.0
diff --git a/requirements/edx/paver.in b/requirements/edx/paver.in
index 4be620eed2..4e86481cb1 100644
--- a/requirements/edx/paver.in
+++ b/requirements/edx/paver.in
@@ -19,5 +19,6 @@ pymongo==2.9.1 # via edx-opaque-keys
python-memcached==1.48 # Python interface to the memcached memory cache daemon
requests # Simple interface for making HTTP requests
stevedore==1.10.0 # via edx-opaque-keys
+urllib3==1.23 # via requests
watchdog # Used in paver watch_assets
wrapt==1.10.5 # Decorator utilities used in the @timed paver task decorator
diff --git a/requirements/edx/paver.txt b/requirements/edx/paver.txt
index 53774b5058..3f785cf2eb 100644
--- a/requirements/edx/paver.txt
+++ b/requirements/edx/paver.txt
@@ -17,14 +17,14 @@ mock==1.0.1
path.py==8.2.1
pathtools==0.1.2 # via watchdog
paver==1.3.4
-pbr==5.0.0 # via stevedore
+pbr==5.1.0 # via stevedore
psutil==1.2.1
pymongo==2.9.1
python-memcached==1.48
pyyaml==3.13 # via watchdog
-requests==2.19.1
+requests==2.20.0
six==1.11.0 # via edx-opaque-keys, libsass, paver, stevedore
stevedore==1.10.0
-urllib3==1.23 # via requests
+urllib3==1.23
watchdog==0.9.0
wrapt==1.10.5
diff --git a/requirements/edx/testing.in b/requirements/edx/testing.in
index f142734231..2da3b0e1b0 100644
--- a/requirements/edx/testing.in
+++ b/requirements/edx/testing.in
@@ -25,6 +25,7 @@ edx-lint # pylint extensions for Open edX repositories
pylint-plugin-utils==0.3 # required by edx-lint and pinned explicitly here because newer versions don't guarantee python 2 support.
# can be removed when we get to python 3
factory_boy==2.8.1 # Library for creating test fixtures, used in many tests
+flake8==3.5.0 # via flake8-polyfill
freezegun # Allows tests to mock the output of assorted datetime module functions
httpretty # Library for mocking HTTP requests, used in many tests
isort # For checking and fixing the order of imports
diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt
index f8c127b71a..369ff38331 100644
--- a/requirements/edx/testing.txt
+++ b/requirements/edx/testing.txt
@@ -109,7 +109,7 @@ django-require==1.0.11
django-rest-swagger==2.2.0
django-sekizai==0.10.0
django-ses==0.8.4
-django-simple-history==2.4.0
+django-simple-history==2.5.1
django-splash==0.2.2
django-statici18n==1.4.0
django-storages==1.4.1
@@ -141,7 +141,7 @@ edx-oauth2-provider==1.2.2
edx-opaque-keys[django]==0.4.4
edx-organizations==1.0.0
edx-proctoring==1.4.0
-edx-rest-api-client==1.8.2
+edx-rest-api-client==1.9
edx-search==1.2.1
edx-submissions==2.0.12
edx-user-state-client==1.0.4
@@ -158,18 +158,18 @@ filelock==3.0.9 # via tox
firebase-token-generator==1.3.2
fixtures==3.0.0 # via testtools
flake8-polyfill==1.0.2 # via radon
-flake8==3.5.0 # via flake8-polyfill
+flake8==3.5.0
flask==1.0.2 # via moto
freezegun==0.3.11
fs-s3fs==0.1.8
fs==2.0.18
funcsigs==1.0.2 # via pytest
functools32==3.2.3.post2 # via parsel
-future==0.16.0
+future==0.17.0
futures==3.2.0 ; python_version == "2.7"
fuzzywuzzy==0.17.0
glob2==0.3
-gunicorn==17.5
+gunicorn==19.0
hash-ring==1.3.1
help-tokens==1.0.3
html5lib==0.999
@@ -182,7 +182,7 @@ ipaddr==2.1.11
ipaddress==1.0.22
isodate==0.6.0
isort==4.3.4
-itsdangerous==0.24 # via flask
+itsdangerous==1.1.0 # via flask
itypes==1.1.0
jinja2-pluralize==0.3.0
jinja2==2.10
@@ -218,11 +218,11 @@ oauth2==1.9.0.post1
oauthlib==2.1.0
openapi-codec==1.3.2
pa11ycrawler==1.6.2
-parsel==1.5.0 # via scrapy
+parsel==1.5.1 # via scrapy
path.py==8.2.1
pathtools==0.1.2
paver==1.3.4
-pbr==5.0.0
+pbr==5.1.0
pdfminer==20140328
piexif==1.0.2
pillow==5.3.0
@@ -260,7 +260,7 @@ pytest-cov==2.5.1
pytest-django==3.1.2
pytest-forked==0.2 # via pytest-xdist
pytest-randomly==1.2.3
-pytest-xdist==1.23.2
+pytest-xdist==1.24.0
pytest==3.6.3
python-dateutil==2.4.0
python-levenshtein==0.12.0
@@ -279,7 +279,7 @@ radon==2.4.0
redis==2.10.6
reportlab==3.5.9
requests-oauthlib==1.0.0
-requests==2.19.1
+requests==2.20.0
rest-condition==1.0.3
rfc6266-parser==0.0.5.post2
rules==2.0
@@ -311,7 +311,7 @@ text-unidecode==1.2 # via faker
tincan==0.0.5
toml==0.10.0 # via tox
tox-battery==0.5.1
-tox==3.5.2
+tox==3.5.3
traceback2==1.4.0 # via testtools, unittest2
transifex-client==0.13.5
twisted==16.6.0 # via pa11ycrawler, scrapy
@@ -335,4 +335,4 @@ xblock-utils==1.2.0
xblock==1.2.2
xmltodict==0.11.0 # via moto
zendesk==1.1.1
-zope.interface==4.5.0 # via twisted
+zope.interface==4.6.0 # via twisted