]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
netcmd: models: EnumField now also supports IntFlag
authorRob van der Linde <rob@catalyst.net.nz>
Thu, 1 Feb 2024 03:52:17 +0000 (16:52 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 8 Feb 2024 02:48:44 +0000 (02:48 +0000)
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>
python/samba/netcmd/domain/models/fields.py

index 0b7e1eb83e49aa1a0b1d61c1fdf1d022f4e553b0..ceec981911993e14195559013407d3c54164a35f 100644 (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))