Commit Graph

17 Commits

Author SHA1 Message Date
M. Zulqarnain
42eacaf8de refactor: pyupgrade in common/util + xblock_django (#26724) 2021-03-09 16:49:51 +05:00
Tim McCormack
80a4437f33 fix: Always save generated anonymous user ID in DB; ignore save=False (#26399)
This deprecates `save=False` for several functions and removes all known
usages of the parameter but does not actually remove the parameter.
Instead, it will emit a deprecation warning if the parameter is used.
We can remove the parameter as soon as we feel sure nothing is using it.

Now that we have refactored `anonymous_id_for_user` to always prefer
retrieving an existing ID from the database -- and observed that only a
small fraction of calls pass save=False -- we can stop respecting
save=False. This opens the door for future improvements, such as generating
random IDs or switching to the external user ID system.

Metrics: I observe that 1 in 16 requests for new, non-request-cached
anon user IDs are made with save=False. But 71% of all calls are served
from the request cache, and 99.7% of the misses are served from the DB.
save=False only appear to come from intermittent spikes as reports are
generated and are low in absolute number.

Also document usage/risk/rotation of secret in anonymous user ID
generation as indicated by `docs/decisions/0008-secret-key-usage.rst`
ADR on `SECRET_KEY` usage.

ref: ARCHBOM-1683
2021-02-08 19:16:05 +00:00
Jawayria
f3846144a5 Applied pylint-amnesty to xblock_django 2021-02-02 15:09:08 +05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Dave St.Germain
fbc18460ca Add support for external user ids to the xblock user service. 2020-04-29 08:55:40 -04:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Dave St.Germain
0573b2e4d4 Grade runtime service support for Staff Graded Points 2019-05-16 10:21:46 -04:00
Amit
65f4a63ecf INCR-248: Make compatible with Python 3.x without breaking Python 2.7… (#20529)
* INCR-248: Make compatible with Python 3.x without breaking Python 2.7 support --> common/djangoapps/xblock_django

* INCR-248: Grouped absolute_import and unicode_literals imports

* INCR-248: Grouped absolute_import and unicode_literals imports for migrations
2019-05-13 12:35:39 -04:00
Eric Fischer
e18448e27d Silence deprecation warnings
https://docs.djangoproject.com/en/1.11/releases/1.10/#using-user-is-authenticated-and-user-is-anonymous-as-methods
2018-05-02 10:03:50 -04:00
Andy Armstrong
93235d118d Reorder imports using isort (except lms and cms) 2017-05-30 16:04:54 -04:00
Kevin Kim
94100f5944 Convert ORA due dates to user preferred time zone 2016-07-21 13:57:20 +00:00
Ned Batchelder
0872732cf0 Fix pylint C7630 (literal used as attribute) violations
There's no need to use a string literal in setattr, delattr, or the
two-argument form of getattr.
2015-11-23 15:32:54 -05:00
muzaffaryousaf
c461541d35 Refactoring tests.
TNL-1185
2015-01-29 13:33:28 +05:00
muzaffaryousaf
7b10d14f5d Adding 'user_is_staff' filed to opt_attrs in xblock user.
TNL-1185
2015-01-28 21:37:25 +05:00
muzaffaryousaf
2189ef7c50 Fixing the library tests.
TNL-836
2015-01-28 15:01:40 +05:00
muzaffaryousaf
4d72910060 Adding get_anonymous_user_id in Xblock 'user' service.
TNL-836
2015-01-28 12:47:49 +05:00
Jason Bau
7f1b60b286 Implement user service to return currently-logged-in user
returns XBlockuser with 2 data layers
2015-01-16 11:40:06 -05:00