Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
53bf4ef3
Commit
53bf4ef3
authored
Apr 11, 2017
by
Eric Fischer
Committed by
GitHub
Apr 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14856 from edx/efischer/waffle_util_cleanup
Waffle Utils Touchup
parents
252515e4
7d2dbf4b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
lms/djangoapps/courseware/tests/test_views.py
+1
-1
openedx/core/djangolib/waffle_utils.py
+8
-7
No files found.
lms/djangoapps/courseware/tests/test_views.py
View file @
53bf4ef3
...
...
@@ -1451,7 +1451,7 @@ class ProgressPageTests(ModuleStoreTestCase):
@ddt.unpack
def
test_progress_queries
(
self
,
enable_waffle
,
initial
,
subsequent
):
self
.
setup_course
()
with
grades_waffle
()
.
override
_in_model
(
ASSUME_ZERO_GRADE_IF_ABSENT
,
active
=
enable_waffle
):
with
grades_waffle
()
.
override
(
ASSUME_ZERO_GRADE_IF_ABSENT
,
active
=
enable_waffle
):
with
self
.
assertNumQueries
(
initial
),
check_mongo_calls
(
1
):
self
.
_get_progress_page
()
...
...
openedx/core/djangolib/waffle_utils.py
View file @
53bf4ef3
...
...
@@ -61,12 +61,13 @@ class WaffleSwitchPlus(WafflePlus):
"""
Overrides the active value for the given switch for the duration of this
contextmanager.
Note: The value is overridden in the request cache
, not
in the model.
Note: The value is overridden in the request cache
AND
in the model.
"""
previous_active
=
self
.
is_enabled
(
switch_name
)
try
:
self
.
override_for_request
(
switch_name
,
active
)
yield
with
self
.
override_in_model
(
switch_name
,
active
):
yield
finally
:
self
.
override_for_request
(
switch_name
,
previous_active
)
...
...
@@ -85,12 +86,12 @@ class WaffleSwitchPlus(WafflePlus):
"""
Overrides the active value for the given switch for the duration of this
contextmanager.
Note: The value is overridden in the
request cache AND in the model
.
Note: The value is overridden in the
model, not the request cache
.
"""
with
self
.
override
(
switch_name
,
active
):
namespaced_switch_name
=
self
.
_namespaced_setting_name
(
switch_name
)
with
waffle_override_switch
(
namespaced_switch_name
,
active
):
yield
namespaced_switch_name
=
self
.
_namespaced_setting_name
(
switch_name
)
with
waffle_override_switch
(
namespaced_switch_name
,
active
):
log
.
info
(
u"
%
sSwitch '
%
s' set to
%
s in model."
,
self
.
log_prefix
,
namespaced_switch_name
,
active
)
yield
@property
def
_cached_switches
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment