def _create_calendar(self, name, username, type= CalendarType.Private): calendar = Calendar(self.env, None, username) calendar.name = name calendar.theme = 1 calendar.type = type id = calendar.insert() return calendar
def _create_calendar(self, name, username, type=CalendarType.Private): calendar = Calendar(self.env, None, username) calendar.name = name calendar.theme = 1 calendar.type = type id = calendar.insert() return calendar
def save(self, req, id, name, theme, type, ref=0): """ Creates or saves a calendar. """ username = req.authname id = id or None if not id: req.perm.require('CALENDAR_CREATE') else: req.perm.require('CALENDAR_MODIFY', self.calendar_realm(id=id)) c = Calendar(self.env, id) c.name = name c.theme = theme c.type = type c.ref = ref if id and c.exists: c.update() else: c.owner = username c.insert() return cal_as_dict(c, username)