Hi,
I have a project that creates some calendar events and outputs them in ical representation. Some of them can include attachments as base64 encoded binary data in ATTACH property. Here the serialization is really slow, like several seconds for 10 MB pdf file.
I tracked down the issue to the foldOneLine function (https://github.com/py-vobject/vobject/blob/master/vobject/base.py#L898). If I use something like this, the same output is generated in a fraction of a second.
def customFoldOneLine(outbuf, input, line_length=75):
chunk_size = line_length - 1
for start in range(0, len(input), chunk_size):
prefix = "\r\n " if start > 0 else ""
outbuf.write(f"{prefix}{input[start:start + chunk_size]}")
outbuf.write("\r\n")
vobject.base.foldOneLine = customFoldOneLine
I don't think the old complex logic is needed anymore in python3.
Hi,
I have a project that creates some calendar events and outputs them in ical representation. Some of them can include attachments as base64 encoded binary data in
ATTACHproperty. Here the serialization is really slow, like several seconds for 10 MB pdf file.I tracked down the issue to the
foldOneLinefunction (https://github.com/py-vobject/vobject/blob/master/vobject/base.py#L898). If I use something like this, the same output is generated in a fraction of a second.I don't think the old complex logic is needed anymore in python3.