Commit Graph

106 Commits

Author SHA1 Message Date
Robert Raposa
280f8e1577 docs: improve CourseWaffleFlag admin docs
Improve the docs for how to configure CourseWaffleFlag
overrides via Django admin.

ARCHBOM-1721
2021-04-06 11:05:44 -04:00
Robert Raposa
650b0c1360 Merge pull request #27118 from regisb/regisb/fix-toggle-state-report-typeerror
[BD-21] fix: TypeError in toggle state report view
2021-03-23 17:32:30 -04:00
Régis Behmo
dae4403ba7 fix: TypeError in toggle state report view
We were attempting to add course overrides twice to objects returned in
the toggle state report view. This was causing a TypeError (and thus a
500 error) because the second time, we were attempting to add entries to
an incorrect object.

This issue was not caught by unit tests because we were not testing the
view with WaffleFlagCourseOverride objects. This commit adds a unit test
to prevent future errors.

This is another fix for PR #27108.
2021-03-23 20:33:48 +01:00
Robert Raposa
cbc803cd15 feat!: remove old waffle classes (#27069)
BREAKING CHANGE: Remove WaffleSwitchNamespace, WaffleSwitch, WaffleFlagNamespace,
and WaffleFlag from waffle_utils, in favor of the Legecy* classes
in edx-toggles. Although this is a breaking change, we have
preemptively removed all known uses.

BD-21
2021-03-23 09:37:48 -04:00
Régis Behmo
78c152975b refactor: migrate toggle state report to edx_toggles
The toggle state report could not be shared with other IDAs. Here we make use
of the newly available report from edx_toggles, and customize it to add data
from WaffleFlagCourseOverrideModel.
2021-03-19 17:14:14 +01:00
Kyle McCormick
9aefd6f986 style: django-not-configured is not a sensible lint-amnesty value (#26862)
django-not-configured is an error raised by pylint (with
the pylint-django plugin) when it's not correctly configured.

We should not be applying lint amnesty for such a violation.
2021-03-05 08:11:58 -05:00
Aarif
01ac3c2ed3 replaced unittest assertions pytest assertions (#26308) 2021-02-11 17:41:41 +05:00
Jawayria
250c94dc6a BOM-2331: Applied pylint-amnesty to waffle_utils, xblock, xmodule_django, zendesk_proxy, __init__.py 2021-02-04 17:49:15 +05:00
Robert Raposa
6e6b6901a0 Merge pull request #26040 from regisb/regisb/remove-waffle-custom-monitoring
[BD-21] Remove soon-to-be-deprecated value monitor in edx-toggles
2021-02-01 14:56:35 -05:00
Régis Behmo
e9de9257cd Improve test coverage of toggle state view 2021-01-13 17:09:24 +01:00
Régis Behmo
16ad959d7b Refactor: convert view methods to functions for easier testing
Just removing the `self` argument from all methods is enough to convert them to simple functions.
2021-01-13 16:31:15 +01:00
Régis Behmo
d04d4291f5 Document non-namespaced waffle classes in ADR
It was finally decided not to use `skip_namespace_assertion` optional
arguments, but `NonNamespacedWaffle*` classes. We update the ADR to reflect
this change.
2021-01-12 16:58:11 +01:00
Régis Behmo
8199c78def Remove soon-to-be-deprecated value monitor in edx-toggles
The WAFFLE_FLAG_CUSTOM_ATTRIBUTES setting and the WaffleFlag.set_monitor_value
method are soon going to be deprecated in edx-toggles. This is going to be done
in a backward-compatible manner, but we'd better be safe by removing references
to these objects early.
2021-01-12 15:52:55 +01:00
Régis Behmo
f29e415353 Fix deprecated usage of WaffleFlag.namespaced_flag_name
As of edx-toggles==1.2.0, the `WaffleFlag.namespaced_flag_name`
attribute is deprecated in favour of `WaffleFlag.name`.
2020-12-15 12:28:57 +01:00
Régis Behmo
216b99264a Upgrade waffle classes to the new edx-toggles API
Waffle classes no longer have namespaces. All features are moved to the
WaffleFlag/WaffleSwitch classes.

Here we use the edx_toggles.toggles.__future__ API, which is available
in 1.2.0. This means that we don't have to upgrade edx-toggles. We
should remove the __future__ imports as soon as we upgrade to 2.0.0.
2020-12-03 16:40:43 +01:00
Régis Behmo
a16cd71046 Start waffle namespace deprecation
By explicitly importing the legacy namespace classes, we make it clear
that we are using soon-to-be-deprecated classes. We will then be able to
start removing the legacy classes, one module at a time.
2020-12-03 16:06:14 +01:00
Régis Behmo
fe9558035e Fix monitored values of CourseWaffleFlag objects
The monitored value was being twice namespaced, resulting in incorrect
names, such as "schedules.schedules.send_updates_for_course".
2020-11-19 10:29:08 +01: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
Robert Raposa
fe9395bd7a Merge pull request #25538 from regisb/regisb/improve-waffle-tests
[BD-21] Improve waffle_utils tests to not rely on internal API
2020-11-06 08:58:18 -05:00
Régis Behmo
19ff82a3da Improve waffle_utils tests to not rely on internal API
This is required for a smooth upgrade of edx-toggles.
2020-11-06 12:11:52 +01:00
Robert Raposa
061d5d8fc5 Merge pull request #25529 from regisb/regisb/better-waffle-deprecation-monitoring
[BD-21] Improve monitoring of waffle deprecation with custom attributes
2020-11-05 15:09:54 -05:00
Régis Behmo
b32fc50947 Improve monitoring of waffle deprecation with custom attributes
We observe a lot of deprecation warnings using the
"deprecated_waffle_utils" custom attribute. To make it easier to track
these items, we add the waffle flag/namespace name to the custom
attribute.
2020-11-05 08:36:03 +01:00
Nizar Mahmoud
3a46e7c5f5 Squashes waffle_utils.WaffleFlag deprecation warning 2020-11-05 02:00:33 +03:00
Régis Behmo
da0623107c Expose SettingToggle and SettingDictToggle objects in the API
Note that settings for which a corresponding SettingToggle or
SettingDictToggle exists are no longer exposed in the "django_settings"
list of the API.
2020-11-04 15:53:48 +01:00
Régis Behmo
c9c1136459 Re-introduce waffle classes (with deprecation warnings)
This is for backward compatibility.
2020-11-03 19:25:37 +01:00
Régis Behmo
b70042435a Deprecate waffle_utils.testutils.override* functions
These functions should from now on be imported from
edx_toggles.toggles.testutils.
2020-11-03 19:25:37 +01:00
Régis Behmo
4586002956 Import waffle classes from edx_toggles instead of waffle_utils
Those classes were ported to edx_toggles. The imports remain in
waffle_utils.__init__ for backward compatibility.
2020-11-03 19:25:37 +01:00
Régis Behmo
3b127f8c92 Deprecate WaffleSwitch.override* methods
This allows us to get rid of the custom WaffleSwitch and
WaffleSwitchNamespace classes from waffle_utils in favour of
edx_toggles.toggles classes.
2020-11-03 19:25:37 +01:00
Régis Behmo
2307dff4c9 Deprecate WaffleFlag.override method
This allows us to get rid of waffle_utils' custom WaffleFlag method.
2020-11-03 19:25:37 +01:00
Robert Raposa
39a7c6498c remove internal references to edx_django_utils
Tests were referring to internal implementation
details of edx-django-utils. This comment removes
those references to free the library up to be
refactored.

ARCHBOM-1584
2020-11-02 16:46:11 -05:00
Régis Behmo
312f0cd749 Fix error in toggle state endpoint in the absence of module_name
When module_name is None, the call to edx-django-utils'
get_code_owner_from_module crashes. So we avoid making that call when
the module_name is None, which sometimes happens (for good reasons or
not, but it's valid behaviour).
2020-10-29 22:59:53 +01:00
Régis Behmo
a27499830c Add deprecation warning comments to waffle_utils code 2020-10-29 22:59:53 +01:00
Régis Behmo
98ffa347d5 Fix waffle_utils unit tests 2020-10-29 22:59:53 +01:00
Régis Behmo
e5500b34a0 Backport override features from edx-toggles to waffle_utils
Note that those features are destined to be deprecated, eventually.
2020-10-29 22:59:52 +01:00
Régis Behmo
db5feec4cf Move waffle_utils/testutils.py to edx-toggles 2020-10-29 22:59:52 +01:00
Régis Behmo
58043727d5 [BD-21] Migrate waffle flag classes to edx-toggles
The same API is preserved, internally, to avoid many changes across the
edx-platform codebase (for now).
2020-10-29 22:59:52 +01:00
Régis Behmo
474da0c5a5 Refactor WaffleFlag and WaffleFlagNamespace internal API
This simplifies the internals of the waffle flag classes in order to
better move them to edx-toggles later.
2020-10-29 22:59:52 +01:00
Régis Behmo
24cf0543f3 [BD-21] Migrate WaffleSwitch to edx-toggles
This makes this class reusable by other IDAs.
2020-10-29 22:59:52 +01:00
Tim McCormack
5b331b2d4d Merge branch 'master' into timmc/misc-metric-attribute
# Conflicts:
#	cms/envs/common.py
#	lms/envs/common.py
2020-09-28 13:56:08 +00:00
Tim McCormack
f29e418264 Revert "Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)" (#25055)
This reverts commit 986a448d9e.
2020-09-28 13:53:57 +00:00
Robert Raposa
1cc4ae2080 ARCHBOM-1339: add ADRs for extracting waffle_utils (#24798)
- Add ADR for the extraction of waffle_utils to
edx-toggles to reuse across IDAs.
- Add ADR for temporarily leaving CourseWaffleFlag
in edx-platform in order to simplify extraction.
- Add ADR for simplifying the interface for
WaffleFlag and WaffleSwitch by removing the
Namespace classes.

ARCHBOM-1339

Co-authored-by: Feanil Patel <feanil@edx.org>
2020-09-25 15:02:46 -04:00
Tim McCormack
89032577ae Fix existing typo in line I touched 2020-09-23 13:18:20 +00:00
Tim McCormack
c71c9d4984 Replace s/metric/attribute/g in waffle_utils and in caller
This changes:

- `WAFFLE_FLAG_CUSTOM_METRICS`
- `WaffleFlagNamespace._set_waffle_flag_metric`
- `_get_waffle_flag_custom_metrics_set` and some other unreferenced
  internals
2020-09-22 23:19:23 +00:00
Ahtisham Shahid
986a448d9e Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)
This reverts commit ba9ee4e151.

Fixed Style lint issue
2020-09-21 13:48:00 +05:00
Tim McCormack
ba9ee4e151 ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)
This uses the new names introduced in edx-django-utils
3.8.0 (edx/edx-django-utils#59), which we're already using, as
well as updating a few other locations where we incorrectly refer
to New Relic custom metrics instead of custom attributes.

Includes a couple of unrelated lint fixes in a file I modified.
2020-09-18 13:33:50 +00:00
Régis Behmo
a4ba4ae45e Clarify many feature toggle annotations across all applications 2020-09-16 15:20:43 +02:00
Régis Behmo
e4fc7e86b5 Fix indentation of waffle flag annotation 2020-09-16 15:19:16 +02:00
Régis Behmo
7d93715880 Rename toggle_expiration_date to toggle_target_removal_date
This is part of the changes brought by code-annotations==0.7.0
2020-09-16 15:19:16 +02:00
Régis Behmo
98a13d6a7e Remove deprecated toggle_status annotation
This annotation is deprecated since code-annotations==0.7.0
2020-09-16 15:19:15 +02:00
Régis Behmo
ab0e21455a Get rid of the toggle_category annotation, now deprecated
Since code-annotations==0.7.0, this annotation is not used anymore.
2020-09-16 15:16:13 +02:00