icalendar.prop.boolean module#
BOOLEAN values from RFC 5545.
- class icalendar.prop.boolean.vBoolean(*args, params=None, **kwargs)[source]#
Bases:
intAn iCalendar boolean value.
Converts between iCalendar
BOOLEANvalue types and Python boolean values. Conforming with RFC 5545 Section 3.3.2, iCalendar boolean values are represented asTRUEorFALSE. Values parsed from iCalendar text are case insensitive.- Parameters:
- Returns:
A new
vBooleaninstance with the supplied property parameters.
Examples
Parse, create, and use iCalendar boolean values.
>>> from icalendar import vBoolean >>> vBoolean.from_ical("TRUE") True >>> vBoolean.from_ical("fAlse") False >>> boolean = vBoolean(True) >>> if boolean: ... print("TRUE") TRUE >>> boolean.to_ical() b'TRUE'
- BOOL_MAP = {'FALSE': False, 'TRUE': True}#
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265 to a vBoolean.
- Parameters:
jcal_property (
list) – The jCal property to parse.- Raises:
JCalParsingError – If the provided jCal is invalid.
- Return type:
- classmethod from_xcal(xml)[source]#
Parse xCal according to RFC 6321.
- Parameters:
parser – Required. The xCal to parse or a parser.
params – Required. The parameters of the xCal element.
- Raises:
XCalParsingError – If the provided xCal is invalid.
- Return type:
VProp
- property ical_value: bool#
BOOLEAN property type according to RFC 5545 Section 3.3.2
- params: Parameters#
- to_ical()[source]#
Converts a
vBooleanto a BOOLEAN property type.This class method takes a
vBoolean—a Python boolean value—and converts it to an iCalendar BOOLEAN property type, in compliance with RFC 5545 Section 3.3.2.- Return type:
- Returns:
Either "TRUE" or "FALSE" as bytes, depending on the value of the
vBoolean.