def switch_add(self, lhs, rhs): if not lhs: raise ValueError("What time shall it happen?") return if '/' not in lhs: raise ValueError("What will the scene's title be?") return time, title = lhs.split('/', 1) try: check_time = utc_from_string( time, self.character.settings.get('timezone')) except ValueError as err: raise ValueError(str(err)) return if not check_time > utcnow(): raise ValueError( "No scheduling things in the past, that's just silly.") return if not title: raise ValueError("What will the scene's title be?") return if not rhs: raise ValueError("What will the scene's description be?") return new_event = Event.objects.create(owner=self.character, title=title, date_schedule=check_time, description=rhs) new_event.setup() self.sys_msg("Your new Event's ID is: %s" % new_event.id) return
def switch_add(self, lhs, rhs): if not lhs: self.error("What time shall it happen?") return if '/' not in lhs: self.error("What will the scene's title be?") return time, title = lhs.split('/', 1) try: check_time = utc_from_string(time, self.character.settings.get('timezone')) except ValueError as err: self.error(unicode(err)) return if not check_time > utcnow(): self.error("No scheduling things in the past, that's just silly.") return if not title: self.error("What will the scene's title be?") return if not rhs: self.error("What will the scene's description be?") return new_event = Event.objects.create(owner=self.character, title=title, date_schedule=check_time, description=rhs) new_event.setup() self.sys_msg("Your new Event's ID is: %s" % new_event.id) return
def switch_reschedule(self, lhs, rhs): if not lhs: self.error("No scene ID entered to reschedule.") return event = Event.objects.filter(id=lhs).first() if not event: self.error("Event not found.") return if not self.caller.is_admin or event.owner != self.character: self.error("Permission denied.") return try: check_time = utc_from_string(rhs, self.character.settings.get('timezone')) except ValueError as err: self.error(unicode(err)) return if not check_time > utcnow(): self.error("No scheduling things in the past, that's just silly.") return event.reschedule(check_time) self.sys_msg("Rescheduled to: %s" % self.caller.display_local_time(date=check_time))
def switch_reschedule(self, lhs, rhs): if not lhs: raise ValueError("No scene ID entered to reschedule.") return event = Event.objects.filter(id=lhs).first() if not event: raise ValueError("Event not found.") return if not self.caller.is_admin or event.owner != self.character: raise ValueError("Permission denied.") return try: check_time = utc_from_string( rhs, self.character.settings.get('timezone')) except ValueError as err: raise ValueError(str(err)) return if not check_time > utcnow(): raise ValueError( "No scheduling things in the past, that's just silly.") return event.reschedule(check_time) self.sys_msg("Rescheduled to: %s" % self.caller.display_local_time(date=check_time))