Instead of going up the stacktrace to find the module names of waffle
flags and switches, we manually pass the module __name__ whenever the
flag is created. This is similar to `logging.getLogger(__name__)`
standard behaviour.
As the waffle classes are used outside of edx-platform, we make the new
module_name argument an optional keyword argument. This will change once
we pull waffle_utils outside of edx-platform.
Note that the module name is normally only required to view the list of
existing waffle flags and switches. The module name should not be
necessary to verify if a flag is enabled. Thus, maybe it would make
sense to create a `add` class methor similar to:
class WaffleFlag:
@classmethod
def add(cls, namespace, flag, module):
instance = cls(namespace, flag)
cls._class_instances.add((instance, module))
28 lines
791 B
Python
28 lines
791 B
Python
"""
|
|
Toggles for Course API.
|
|
"""
|
|
|
|
|
|
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlag, WaffleFlagNamespace
|
|
|
|
|
|
COURSE_BLOCKS_API_NAMESPACE = WaffleFlagNamespace(name=u'course_blocks_api')
|
|
|
|
# Waffle flag to hide access denial message.
|
|
# .. toggle_name: course_blocks_api.hide_access_denials
|
|
# .. toggle_implementation: WaffleFlag
|
|
# .. toggle_default: False
|
|
# .. toggle_description: ??
|
|
# .. toggle_category: course api
|
|
# .. toggle_use_cases: incremental_release, open_edx
|
|
# .. toggle_creation_date: 2019-04-10
|
|
# .. toggle_expiration_date: ??
|
|
# .. toggle_warnings: ??
|
|
# .. toggle_tickets: ??
|
|
# .. toggle_status: ??
|
|
HIDE_ACCESS_DENIALS_FLAG = WaffleFlag(
|
|
waffle_namespace=COURSE_BLOCKS_API_NAMESPACE,
|
|
flag_name=u'hide_access_denials',
|
|
module_name=__name__,
|
|
)
|