Skip to content

Commit 58a70f7

Browse files
mauritiumtobixen
authored andcommitted
Fixing _set_icalendar_component: language not defined
1 parent 4717f60 commit 58a70f7

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

caldav/objects.py

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,8 +2187,8 @@ def _set_icalendar_component(self, value) -> None:
21872187
self.icalendar_instance.subcomponents[i[0]] = value
21882188
else:
21892189
my_instance = icalendar.Calendar()
2190-
my_instance.add("prodid", "-//python-caldav//caldav//" + language)
2191-
my_instance.add("version", "2.0")
2190+
my_instance.add("prodid", self.icalendar_instance["prodid"])
2191+
my_instance.add("version", self.icalendar_instance["version"])
21922192
my_instance.add_component(value)
21932193
self.icalendar_instance = my_instance
21942194

tests/test_caldav_unit.py

100644100755
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,19 @@ def testComponent(self):
10981098
== "Submit Quebec Income Tax Return for 2006"
10991099
)
11001100

1101+
def testComponentSet(self):
1102+
cal_url = "http://me:hunter2@calendar.example:80/"
1103+
client = DAVClient(url=cal_url)
1104+
target = Event(client, data=evr)
1105+
1106+
## Creating some dummy data such that the target has more than one subcomponent
1107+
target.expand_rrule(start=datetime(1996, 10, 10), end=datetime(1999, 12, 12))
1108+
assert len(target.icalendar_instance.subcomponents) == 3
1109+
1110+
## The following should not fail within _set_icalendar_component
1111+
target.icalendar_component = icalendar.Todo.from_ical(todo).subcomponents[0]
1112+
assert len(target.icalendar_instance.subcomponents) == 1
1113+
11011114
def testTodoDuration(self):
11021115
cal_url = "http://me:hunter2@calendar.example:80/"
11031116
client = DAVClient(url=cal_url)

0 commit comments

Comments
 (0)