Skip to content

Commit 02d750d

Browse files
samrodri911IoannaGiagstevepiercy
authored
Docstring url property 1244 (#1425)
* Fix: Add Examples section heading and increase indentation - Rename news file to 1244.documentation.1 to avoid conflict - Add 'Examples:' section heading - Increase indentation of example code blocks (4 spaces) - Ensure proper rendering in documentation * fix: remove undefined source_property from __all__ exports AI Disclosure: - Model used: Gemini - Interaction: Assisted in locating and resolving the F822 undefined name error in the __all__ list. * Update src/icalendar/attr.py Co-authored-by: Steve Piercy <web@stevepiercy.com> --------- Co-authored-by: IoannaGiag <t8230022@aueb.gr> Co-authored-by: Steve Piercy <web@stevepiercy.com>
1 parent 116b055 commit 02d750d

2 files changed

Lines changed: 54 additions & 16 deletions

File tree

news/1244.documentation.1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved the documentation for ``attr.url_property`` by converting raw RFC text into a comprehensive Python docstring with usage examples and explicit RFC cross-references. Assisting tool: Gemini 1.5. @samrodri911

src/icalendar/attr.py

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,28 +1353,65 @@ def fset(self: Component, value: str | StrEnum | None) -> None:
13531353

13541354
url_property = single_string_property(
13551355
"URL",
1356-
"""A Uniform Resource Locator (URL) associated with the iCalendar object.
1356+
"""A Uniform Resource Locator (URL) associated with a calendar component.
13571357
1358-
Description:
1359-
This property may be used in a calendar component to
1360-
convey a location where a more dynamic rendition of the calendar
1361-
information associated with the calendar component can be found.
1362-
This memo does not attempt to standardize the form of the URI, nor
1363-
the format of the resource pointed to by the property value. If
1364-
the URL property and Content-Location MIME header are both
1365-
specified, they MUST point to the same resource.
1358+
This property specifies a URI where a more dynamic rendition of the calendar
1359+
information can be found. It is commonly used to reference related resources
1360+
or provide additional information about the component.
13661361
1367-
Conformance:
1368-
This property can be specified once in the "VEVENT",
1369-
"VTODO", "VJOURNAL", or "VFREEBUSY" calendar components.
1370-
Since :rfc:`7986`, this property can also be defined on a "VCALENDAR".
1362+
According to :rfc:`5545#section-3.8.4.6`, this property can be specified
1363+
once in "VEVENT", "VTODO", "VJOURNAL", or "VFREEBUSY" calendar components.
1364+
Since :rfc:`7986#section-5.5`, this property can also be defined on a
1365+
"VCALENDAR". :rfc:`7953#section-3.1` allows this property in "VAVAILABILITY" components.
13711366
1372-
Example:
1373-
The following is an example of this property:
1367+
This property may be used in a calendar component to convey a location
1368+
where a more dynamic rendition of the calendar information can be found.
1369+
If both the URL property and Content-Location MIME header are specified,
1370+
they MUST point to the same resource.
13741371
1375-
.. code-block:: ics
1372+
This differs from the SOURCE property, which identifies where calendar
1373+
data can be refreshed from, whereas URL provides an alternative
1374+
representation of the current calendar data.
1375+
1376+
Examples:
13761377
1378+
Set a URL for an event that references additional information:
1379+
1380+
.. code-block:: pycon
1381+
1382+
>>> from icalendar import Event
1383+
>>> event = Event()
1384+
>>> event.add('url', 'http://example.com/events/meeting-2025')
1385+
>>> print(event.to_ical().decode('utf-8'))
1386+
BEGIN:VEVENT
1387+
URL:http://example.com/events/meeting-2025
1388+
END:VEVENT
1389+
1390+
Set a URL for a calendar:
1391+
1392+
.. code-block:: pycon
1393+
1394+
>>> from icalendar import Calendar
1395+
>>> calendar = Calendar()
1396+
>>> calendar.add('url', 'http://example.com/pub/calendars/jsmith/mytime.ics')
1397+
>>> print(calendar.to_ical().decode('utf-8'))
1398+
BEGIN:VCALENDAR
13771399
URL:http://example.com/pub/calendars/jsmith/mytime.ics
1400+
END:VCALENDAR
1401+
1402+
See also:
1403+
:attr:`~icalendar.cal.calendar.Calendar.source` for specifying from where
1404+
calendar data can be refreshed.
1405+
1406+
icalendar implementations:
1407+
1408+
- :attr:`Availability.url <icalendar.cal.availability.Availability.url>`
1409+
- :attr:`Calendar.url <icalendar.cal.calendar.Calendar.url>`
1410+
- :attr:`Event.url <icalendar.cal.event.Event.url>`
1411+
- :attr:`FreeBusy.url <icalendar.cal.free_busy.FreeBusy.url>`
1412+
- :attr:`Journal.url <icalendar.cal.journal.Journal.url>`
1413+
- :attr:`Todo.url <icalendar.cal.todo.Todo.url>`
1414+
13781415
13791416
""",
13801417
)

0 commit comments

Comments
 (0)