This change allows us to define FLAG_SOURCES as a dotted list of Python paths to classes that provide a get_flags() method that returns a dictionary of flags names and Condition objects.
(These are the defaults to preserve current behavior.)
This should provide some performance improvement when coupled with #11 because database flag conditions will only be queried once per request, no matter how many flags there are.
This opens up potential for supporting sources of flags and conditions that are not just the settings files or the database, and lets someone disable either database or settings flags as a thing entirely.
This change breaks the previous behavior of the FLAG_SOURCES setting and the results of using get_flags(), but neither of these were officially documented. get_flags() is used by Wagtail-Flags, and support for the changes here can be found in https://github.com/cfpb/wagtail-flags/pull/32.
This change allows us to define
FLAG_SOURCES
as a dotted list of Python paths to classes that provide aget_flags()
method that returns a dictionary of flags names andCondition
objects.FLAG_SOURCES
is expected to like this:(These are the defaults to preserve current behavior.)
This should provide some performance improvement when coupled with #11 because database flag conditions will only be queried once per request, no matter how many flags there are.
This opens up potential for supporting sources of flags and conditions that are not just the settings files or the database, and lets someone disable either database or settings flags as a thing entirely.
This change breaks the previous behavior of the
FLAG_SOURCES
setting and the results of usingget_flags()
, but neither of these were officially documented.get_flags()
is used by Wagtail-Flags, and support for the changes here can be found in https://github.com/cfpb/wagtail-flags/pull/32.