1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

netcmd: models: EnumField now also supports IntFlag

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Rob van der Linde 2024-02-01 16:52:17 +13:00 committed by Andrew Bartlett
parent 3c8d449ad3
commit 4595a1dae3

View File

@ -20,7 +20,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from enum import IntEnum
from enum import IntEnum, IntFlag
import io
from abc import ABCMeta, abstractmethod
@ -181,7 +181,7 @@ class EnumField(Field):
Has a special case for IntEnum as the constructor only accepts int.
"""
if issubclass(self.enum, IntEnum):
if issubclass(self.enum, (IntEnum, IntFlag)):
return self.enum(int(str(value)))
else:
return self.enum(str(value))