mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-15 20:36:55 +00:00
Fix compatibility between python2 and 3
This commit is contained in:
parent
6c40f5e24a
commit
a631c8c761
5 changed files with 18 additions and 11 deletions
|
@ -25,6 +25,7 @@ Multi files per calendar filesystem storage backend.
|
|||
import os
|
||||
import shutil
|
||||
import time
|
||||
import sys
|
||||
|
||||
from . import filesystem
|
||||
from .. import ical
|
||||
|
@ -50,7 +51,10 @@ class Collection(filesystem.Collection):
|
|||
components = [i for i in items if isinstance(i, ical.Component)]
|
||||
for component in components:
|
||||
text = ical.serialize(self.tag, headers, [component] + timezones)
|
||||
path = os.path.join(self._path, component.name)
|
||||
name = (
|
||||
component.name if sys.version_info[0] >= 3 else
|
||||
component.name.encode(filesystem.FILESYSTEM_ENCODING))
|
||||
path = os.path.join(self._path, name)
|
||||
with filesystem.open(path, "w") as fd:
|
||||
fd.write(text)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue