icalendar.prop.text module#

TEXT values from RFC 5545.

class icalendar.prop.text.vText(value, encoding='utf-8', /, params: dict[str, Any] | None = None)[source]#

Bases: str

Simple text.

property ALTREP: str | None#

ALTREP - Specify an alternate text representation for the property value.

Description:

This parameter specifies a URI that points to an alternate representation for a textual property value. A property specifying this parameter MUST also include a value that reflects the default representation of the text value. The URI parameter value MUST be specified in a quoted-string.

Note

While there is no restriction imposed on the URI schemes allowed for this parameter, Content Identifier (CID) RFC 2392, HTTP RFC 2616, and HTTPS RFC 2818 are the URI schemes most commonly used by current implementations.

property GAP: timedelta | None#
Purpose:

GAP specifies the length of the gap, positive or negative, between two components with a temporal relationship.

Format Definition:

Same as the DURATION value type defined in RFC 5545, Section 3.3.6.

Description:

This parameter MAY be specified on the RELATED-TO property and defines the duration of time between the predecessor and successor in an interval. When positive, it defines the lag time between a task and its logical successor. When negative, it defines the lead time.

Examples

An example of lag time might be if Task-A is "paint the room" and Task-B is "lay the carpets". Then, Task-A may be related to Task-B with RELTYPE=FINISHTOSTART with a gap of 1 day -- long enough for the paint to dry.

====================
|  paint the room  |--+
====================  |
                      |(lag of one day)
                      |
                      |  ===================
                      +->| lay the carpet  |
                         ===================

For an example of lead time, in constructing a two-story building, the electrical work must be done before painting. However, the painter can move in to the first floor as the electricians move upstairs.

=====================
|  electrical work  |--+
=====================  |
         +-------------+
         |(lead of estimated time)
         |  ==================
         +->|    painting    |
            ==================
property LANGUAGE: str | None#

Specify the language for text values in a property or property parameter.

Description:

This parameter identifies the language of the text in the property value and of all property parameter values of the property. The value of the "LANGUAGE" property parameter is that defined in RFC 5646.

For transport in a MIME entity, the Content-Language header field can be used to set the default language for the entire body part. Otherwise, no default language is assumed.

property RELTYPE: RELTYPE#

Specify the type of hierarchical relationship associated with a component.

Conformance:

RFC 5545 introduces the RELTYPE property parameter. RFC 9253 adds new values.

Description:

This parameter can be specified on a property that references another related calendar. The parameter specifies the hierarchical relationship type of the calendar component referenced by the property. The parameter value can be PARENT, to indicate that the referenced calendar component is a superior of calendar component; CHILD to indicate that the referenced calendar component is a subordinate of the calendar component; or SIBLING to indicate that the referenced calendar component is a peer of the calendar component. If this parameter is not specified on an allowable property, the default relationship type is PARENT. Applications MUST treat x-name and iana-token values they don't recognize the same way as they would the PARENT value.

property VALUE: str#

The VALUE parameter or the default.

Purpose:

VALUE explicitly specify the value type format for a property value.

Description:

This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.

If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.

Applications MUST preserve the value data for x-name and iana-token values that they don't recognize without attempting to interpret or parse the value data.

Returns:

The VALUE parameter or the default.

Examples

The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.

>>> from icalendar import vBoolean
>>> b = vBoolean(True)
>>> b.VALUE
'BOOLEAN'

Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:

>>> from icalendar import vUnknown, Event
>>> v = vUnknown("Some property text.")
>>> v.VALUE = "x-type"  # lower case
>>> v.VALUE
'X-TYPE'
>>> event = Event()
>>> event.add("x-prop", v)
>>> print(event.to_ical())
BEGIN:VEVENT
X-PROP;VALUE=X-TYPE:Some property text.
END:VEVENT
default_value: ClassVar[str] = 'TEXT'#
encoding#
classmethod examples()[source]#

Examples of vText.

classmethod from_ical(ical)[source]#
classmethod from_jcal(jcal_property)[source]#

Parse jCal from RFC 7265.

Parameters:

jcal_property (list) -- The jCal property to parse.

Raises:

JCalParsingError -- If the provided jCal is invalid.

Return type:

None

property ical_value: str#

The string value of the text.

params: Parameters#
classmethod parse_jcal_value(jcal_value)[source]#

Parse a jCal value into a vText.

Return type:

None

to_ical()[source]#
Return type:

bytes

to_jcal(name)[source]#

The jCal representation of this property according to RFC 7265.

Return type:

list