Commit Graph

598 Commits

Author SHA1 Message Date
Jawayria
dba7d78c74 chore: Applied lint-amnesty on openedx/core/lib 2021-12-02 15:11:13 +05:00
Jillian Vogel
ad5ad72273 [BD-13] Deprecate ModuleSystem.render_template (fixed) (#29354)
* refactor: deprecates ModuleSystem.render_template

in favor of the added MakoSystem render_template method.

Related changes:
* Adds the MakoService to the StudioEditModuleRuntime,
  PreviewModuleSystem, LmsModuleSystem, and XBlockRuntime
* MakoService constructor takes a `namespace_prefix` string, so that the
  CMS PreviewModuleSystem can render to LMS templates, without needing
  the special render_from_lms helper method.
* ModuleSystem.render_template becomes a read-only property, so the
  constructor calls and test module systems are updated accordingly.
* Adds tests for the MakoService and module system shims.

(cherry picked from commit 457f959356)

* refactor: use MakoService.render_template to remove deprecation warnings

from block code.

(cherry picked from commit 8d62d337f5)

* refactor: use MakoService.render_template to remove deprecation warnings

from test code.

(cherry picked from commit 26b43465a4)

* test: Adds a test to verify the bug introduced by the previous changes

The AuthoringMixin is automatically added to all XBlocks (see
settings.XBLOCK_MIXINS), and AuthoringMixin.visibility_view expects the
"mako" service.

This test verifies the bug by testing the PureXBlock, which does not
require the "mako" service, and so fails when the visibility_view is
rendered.

* fix: AuthoringMixin needs mako service

which fixes the visibility_view for XBlocks which don't explicitly
require the mako service.

Also removes the unneeded class property _services_requested from
AuthoringMixin and StudioEditableBlock. This property is better provided
by the XBlockMixin class.
2021-11-29 14:42:52 -05:00
Kshitij Sobti
c8bd924e23 feat: Add support for using the discussions MFE UI instead of existing UI [BD-38] [TNL-9228] (#29285)
* feat: Add support for using the discussions MFE UI instead of existing UI

Adds a new course waffle flag that when set along with the discussions MFE URL shows the discussions MFE UI instead of the regular UI.

* test: add tests

* squash!: more consistent url name
2021-11-23 14:56:25 +05:00
Justin Lapierre
f6f3a79a15 Revert "[BD-13] Deprecate ModuleSystem.render_template" 2021-11-16 15:16:08 -05:00
Ned Batchelder
d9dd10dc97 style: code cleanups from Steven Burch (#29292)
* chore: update deprecated import from collections

* chore: remove outdated imports from markdown library

as it hasn't been supported since 2.0.3 and we're on 3.x.
This was deprecated at least as early as 2012!

* docs: add docstring and remove lint-amnesty to markdown plugin

* chore: remove deprecated etree import

* style: remove unnecessary-comprehension for sets

* style: resolve a number of amnestied pylint complaints

Co-authored-by: stvn <stvn@mit.edu>
2021-11-10 07:11:57 -08:00
Jillian Vogel
8d62d337f5 refactor: use MakoService.render_template to remove deprecation warnings
from block code.
2021-11-09 14:03:54 +10:30
Kshitij Sobti
ff61434893 feat: Add a new way to enable/disable teams [BD-38] [TNL-9175] [BB-5066] (#29099)
* feat: Add a new way to enable/disable teams

Adds a new mechanism for enabling/disabling the team feature in a course using an 'enabled' field to the teams config.
If this field is set to true, teams is enabled (team sets/groups) still need to be defined. If this is set to false then teams is disabled whether or not team sets are defined.

* fix: review feedback
2021-11-01 17:12:06 +05:00
Agrendalath
e633cc9c24 feat: support adding custom editors to Studio
This:
1. Introduces a variable for the Course Outline view in Studio.
   A custom theme can override it to add new editors.
2. Exports a function for creating new editor modals.
   A custom theme can use it to create editors without adding boilerplate code.
3. Adds a pluggable override for XBlock fields that are passed to the Studio.
   Without this, custom editors in Studio cannot retrieve values of XBlock fields.
2021-10-27 13:35:19 -04:00
M. Zulqarnain
43008723be feat: New codemods on OpenedX 3 (#28778) 2021-10-22 13:55:51 +05:00
Kshitij Sobti
2ecb4daece fix: update course URL match pattern to also match learning MFE (#29050)
The learning MFE paths include /course/{course_id} which doesn't match /courses/{course_id} which is what the regex expects. This causes issues with the Wiki when when accessed from the learning MFE doesn't detect that course it's related to in the middleware.
2021-10-21 20:24:40 +05:00
Usama Sadiq
9ee8df0980 fix: Remove pylint constraint and fix warnings (#28646) 2021-10-20 23:00:13 +05:00
Robert Raposa
f3e5838b89 docs: update unexpected_multiple_exceptions comment (#28939)
Update the unexpected_multiple_exceptions comment based on findings
from monitoring since this was originally released.
2021-10-05 14:08:22 -04:00
Kshitij Sobti
9e787a09bc chore: remove dependency on rest_condition (#28663)
rest-condition has not been updated for a while, and with DRF 3.9 it is no longer needed since the ability to combine Permission classes using boolean operators is now provided by DRF directly.
2021-10-04 15:38:17 -04:00
Rebecca Graber
bf025a9b0c feat: Add custom attribute for cookie header size
ARCHBOM-1910
2021-10-01 08:09:41 -04:00
Rebecca Graber
2ffbbeba9a chore: lint 2021-09-30 14:46:31 -04:00
Rebecca Graber
adcc9cb9b8 fix: tests 2021-09-30 14:34:57 -04:00
Rebecca Graber
0356d96b67 chore: lint 2021-09-30 12:50:04 -04:00
Rebecca Graber
8454c5bfcb chore: lint 2021-09-30 12:12:29 -04:00
Rebecca Graber
9e44714f4a feat: add custom attribute for total cookie header size 2021-09-30 11:45:55 -04:00
Usama Sadiq
d5e2ac9b0e fix: update static file path in tests (#28872)
fix similar test in openedx
2021-09-30 19:16:23 +05:00
Kshitij Sobti
8cf751a405 feat: Add REST APIs for course advanced settings and course tabs
This commit adds new APIs that allow MFEs to modify a course's advanced settings
and to update tab settings to show/hide/move tabs.
2021-08-31 11:11:46 +05:00
Maria Grimaldi
2ee52ea96c refactor: replace some create_user with UserFactory to avoid non-existent profile errors 2021-08-24 15:49:21 -04:00
Michael Terry
033497d1d7 fix: modernize look of in-xblock shift-dates banner
Specifically, use our standard warning-banner colors and add a
drop shadow. Also, updates the text to match the text used
elsewhere.

AA-835
2021-08-16 09:18:05 -04:00
Jawayria
27b52c4279 chore: Executed codemods on openedx module 2021-08-02 21:06:32 +05:00
Manjinder Singh
19b45069fa feat: adding more parameters (#28264)
* fix: adding more parameters for cookie monitoring

Added: cookies_total_num, cookies_unaccounted_size. 
  -Both are to help us gauge how many cookies we are not collecting data for.
Increased: # of cookies data collected
2021-07-26 09:11:44 -04:00
Usama Sadiq
1795008686 fix: Removed pylint constraint (#28222)
Disabled pylint warnings in pylint_tweaks
2021-07-23 18:35:57 +05:00
Diana Huang
29548459fa refactor: Remove PyContracts usage. (#27887)
* refactor: Remove PyContracts usage.

We have not used PyContracts in a while and it is overhead we don't
need in edx-platform.

https://openedx.atlassian.net/browse/DEPR-147

* chore: Updating Python Requirements (#28018)

Co-authored-by: edX requirements bot <49161187+edx-requirements-bot@users.noreply.github.com>
2021-06-23 18:24:06 -04:00
Kshitij Sobti
d2c2fcdefe feat: Course Apps API [BD-38] [TNL-8103] [BB-2716] (#27542)
* feat: Course Apps API

This adds a new concept called course apps. These are exposed via a new
"openedx.course_app" entrypoint, which helps the LMS and studio discover such
apps and list them in a new rest api for the same.

These course apps will drive the pages and resources view in the course authoring
MFE. This system will track which apps are enabled and which are disabled. It
also allows third-party apps to be listed here by using the plugin entrypoint.

* Apply feedback from review
2021-06-23 21:51:12 +05:00
Usama Sadiq
4f4be6538a BOM-2477: pylint warnings lint-amnesty (#27585) 2021-05-11 17:22:40 +05:00
Usama Sadiq
64752ed66c refactor: pyupgrade second iteration (#27459) 2021-05-10 13:56:40 +05:00
Kshitij Sobti
161e3560dd feat: Add REST endpoints for problem response report generation that can be driven by MFEs. (#27313) 2021-05-06 14:05:14 -04:00
Usama Sadiq
2b55959a8e refactor: apply lint-amnesty on existing violations 2021-04-20 23:51:31 +05:00
stvn
43698fff0a refactor: Move get_course_by_id helper from LMS to core
This helper is used by the LMS, CMS, _and_ `openedx.core`,
so let's move it to `openedx.core` to reduce import complexity.

The following files no longer import from LMS:
- cms/djangoapps/contentstore/management/commands/edit_course_tabs.py
- lms/djangoapps/ccx/migrations/0006_set_display_name_as_override.py
- openedx/core/djangoapps/ccxcon/api.py
- openedx/core/djangoapps/verified_track_content/models.py
- openedx/features/course_experience/plugins.py

Note: The LTI XBlock has a dependency on this import path (!?);
a fix can be found here [1].

- [1] https://github.com/edx/xblock-lti-consumer/pull/154
2021-04-13 23:25:48 -07:00
Jawayria
953f1fa05c Merge pull request #26615 from edx/jawayria/bom-2408-7
BOM-2408: Removed unused imports from openedx/core/{djangolib, lib} a…
2021-04-12 14:45:52 +05:00
Usama Sadiq
068ac5290f refactor: Ran pyupgrade on openedx/core
Ran pyupgrade on openedx/core/{lib, tests}
2021-04-08 18:34:38 +05:00
Usama Sadiq
8de47ef51f refactor: Ran pyupgrade on openedx/core
Ran pyupgrade on openedx/core/{djangolib, lib}
2021-04-08 18:34:24 +05:00
Piotr Surowiec
bc1e9afe4b feat: allow overriding unit icons (#21433)
This:
1. Introduces a new override using the `pluggable_override` decorator.
It is now possible to specify a custom way of getting XBlock's icon
by defining `GET_UNIT_ICON_IMPL` in settings.
2. Introduces a way to add custom `XBLOCK_MIXINS` by defining
`XBLOCK_EXTRA_MIXINS` in settings. This allows, e.g. to add
new fields to XBlocks.
2021-04-07 09:42:12 -04:00
Jawayria
4cdf466215 refactor: Removed unused imports
Removed unused imports from openedx/core/{djangolib, lib} and openedx/{tests, features}
2021-04-06 17:24:04 +05:00
M. Zulqarnain
072b6b8875 Revert "chore: Unpin python-dateutil (#27196)" (#27217)
This reverts commit 40878cd554.
2021-04-01 23:32:51 +05:00
M. Zulqarnain
40878cd554 chore: Unpin python-dateutil (#27196) 2021-04-01 19:53:02 +05:00
Robert Raposa
d4bbd9d03e fix: move ignored error message custom attribute (#27047)
The `error_expected` custom attribute used to contain
both the class name and the error message. This had
the following issues:

* Combining data in the same custom attribute limits
the ability to query.
* The additional error class and message data is only
needed for ignored errors, since this data isn't
available elsewhere.

The following changes were made:
* `error_expected` will always have the value True
if present.
* `error_ignored` no longer exists.
* `error_ignored_class` will contain the error module
and class for ignored errors.
* `error_ignored_message` will contain the error message
for ignored errors.

ARCHBOM-1708
2021-03-18 10:37:47 -04:00
Robert Raposa
2c0a8242f7 ARCHBOM-1708: feat: monitor and log expected errors (#26980)
Adds logging and monitoring capabilities for expected
errors. See the ADR and how-to  documentation for
details of how to configure and use the EXPECTED_ERRORS
setting and new monitoring and logging.

ARCHBOM-1708

Co-authored-by: Tim McCormack <tmccormack@edx.org>
2021-03-17 07:27:13 -04:00
Usman Khalid
23d1e5b654 Remove unused RawDescriptor and EmptyDataRawDescriptor. 2021-03-11 22:20:33 +05:00
Usman Khalid
dd96a2aa72 Convert Course, Section and Sequence XModules to XBlocks. (#25965) 2021-03-02 10:29:33 -05:00
Feanil Patel
d2343b1f07 doc: Correctly annotate the setting name.
The `setting_name` annotation needed a space before it so that it's
picked up properly by the toggle annotations tooling.
2021-03-01 16:35:41 -05:00
Aarif
813064ad49 replaced unittest assertions pytest assertions (#26574) 2021-02-22 20:04:51 +05:00
usamasadiq
96f0915b0f Fixed new pylint warnings.
use generator in any/all()
disable not-callable warnings
disable no-member warnings
Suppressed smaller pylint warnings
Pin edx-proctoring==3.5.0
2021-02-22 16:36:53 +05:00
David Ormsbee
843668a011 Revert "feat: 403 logging for exchange_access_token (#26511)" (#26608)
This reverts commit 0517603b6d.

This was masking a LabXchange error by blowing up with:
"Stack trace builtins:AttributeError: 'NoneType' object has no attribute 'status_code'"
2021-02-17 17:08:44 -05:00
Robert Raposa
0517603b6d feat: 403 logging for exchange_access_token (#26511)
The mobile app is getting unexpected 403s from
/oauth2/exchange_access_token/, but we have been unable
to pinpoint from where they are coming. This commit
introduces a temporary exception handler to provide stack info
for 403s on this endpoint to try to track down the source.

Requires the ENABLE_403_MONITORING setting to be set to
True to enable the logging.

ARCHBOM-1667
2021-02-12 15:34:55 -05:00
Jawayria
fc08dd3ff5 Resolved error 2021-02-03 17:13:09 +05:00