def cal_vdir(tmpdir): cal = Calendar(cal1, ':memory:', str(tmpdir), color='dark blue', locale=locale) vdir = FilesystemStorage(str(tmpdir), '.ics') return cal, vdir
def coll_vdirs(tmpdir): coll = CalendarCollection() vdirs = dict() for name in example_cals: path = str(tmpdir) + '/' + name os.makedirs(path, mode=0o770) coll.append(Calendar(name, ':memory:', path, **KWARGS)) vdirs[name] = FilesystemStorage(path, '.ics') return coll, vdirs
def __init__(self, name, dbpath, path, readonly=False, color='', unicode_symbols=True, default_tz=None, local_tz=None): """ :param name: the name of the calendar :type name: str :param dbpath: path where the local chaching db should be saved :type dbpath: str :param readonly: if True, this Calendar cannot be modified :type readonly: bool :param color: the color which this calendar's events should be printed in :type color: str :param unicode_symbols: if True, unicode symbols will be used for representing this calendars's events properties :type unicode_symbols: bool :param default_tz: timezone used by default :tpye default_tz: pytz.timezone :param local_tz: the timezone this calendar's event's times should be shown in :type local_tz: pytz.timezone """ self._default_tz = default_tz self._local_tz = default_tz if local_tz is None else local_tz self.name = name self.color = color self.path = os.path.expanduser(path) self._dbtool = backend.SQLiteDb( self.name, dbpath, default_tz=self._default_tz, local_tz=self._local_tz, ) self._storage = FilesystemStorage(path, '.ics') self._readonly = readonly self._unicode_symbols = unicode_symbols if self._db_needs_update(): self.db_update()
def __init__(self, name, dbpath, path, readonly=False, color='', unicode_symbols=True, default_tz=None, local_tz=None, debug=True): self._default_tz = default_tz self._local_tz = default_tz if local_tz is None else local_tz self.name = name self.color = color self.path = path self._debug = debug self._dbtool = backend.SQLiteDb( dbpath, default_tz=self._default_tz, local_tz=self._local_tz, debug=self._debug) self._storage = FilesystemStorage(path, '.ics') self._readonly = readonly self._unicode_symbols = unicode_symbols if self._db_needs_update(): self.db_update()
def __init__(self, name, dbpath, path, readonly=False, color='', unicode_symbols=True, locale=None): """ :param name: the name of the calendar :type name: str :param dbpath: path where the local chaching db should be saved :type dbpath: str :param readonly: if True, this Calendar cannot be modified :type readonly: bool :param color: the color which this calendar's events should be printed in :type color: str :param unicode_symbols: if True, unicode symbols will be used for representing this calendars's events properties :type unicode_symbols: bool :param locale: the locale settings :type locale: dict() """ self._locale = locale self.name = name self.color = color self.path = os.path.expanduser(path) self._dbtool = backend.SQLiteDb(self.name, dbpath, locale=self._locale) create_directory(path) self._storage = FilesystemStorage(path, '.ics') self._readonly = readonly self._unicode_symbols = unicode_symbols if self._db_needs_update(): self.db_update()
def cal_vdir(tmpdir): cal = Calendar(cal1, ':memory:', str(tmpdir), **KWARGS) vdir = FilesystemStorage(str(tmpdir), '.ics') return cal, vdir