Пример #1
0
 def __init__(self, is_case_sensitive: bool = False):
     """
     :param is_case_sensitive: If True, consider name with different
     case as different.
     """
     self._is_case_sensitive = is_case_sensitive
     self._workspace_api = UnsafeWorkspaceApi(None)
     self._content_api = ContentApi(None)
Пример #2
0
    def get_calendar(self, type: str, id: str, path: str) -> Calendar:
        """
        Return tracim.model.organisational.Calendar instance for given
        parameters.
        :param type: Type of calendar, can be one of CALENDAR_TYPE_USER,
        CALENDAR_TYPE_WORKSPACE
        :param id: related calendar object id
        :param path: path representation like user/42--foo.ics
        :return: a calendar.
        """
        if type == CALENDAR_TYPE_USER:
            user = UserApi(self._user).get_one_by_id(id)
            return UserCalendar(user, path=path)

        if type == CALENDAR_TYPE_WORKSPACE:
            workspace = UnsafeWorkspaceApi(self._user).get_one(id)
            return WorkspaceCalendar(workspace, path=path)

        raise UnknownCalendarType('Type "{0}" is not implemented'.format(type))