def __init__(self, account, **kwargs): super(Event, self).__init__() self.account = account self.title = nstrip(mpop(kwargs, 'title', 'sessionName', 'confName')) self._starts_at = mpop(kwargs, 'starts_at', '_starts_at') self._ends_at = mpop(kwargs, 'ends_at', '_ends_at') self._started_at = mpop(kwargs, 'started_at', '_started_at') self._ended_at = mpop(kwargs, 'ended_at', '_ended_at') if kwargs.get('timeZoneID'): # this comes from normal listing tz = timezone.WEBEX_TIMEZONE_ID_TO_PYTZ_LABEL_MAP[int( kwargs['timeZoneID'])] if self._starts_at is None and kwargs.get('startDate'): self._starts_at = time(kwargs['startDate'], tz) if self._ends_at is None and kwargs.get('endDate'): self._ends_at = time(kwargs['endDate'], tz) if kwargs.get('timezone'): # this comes form historical listing tz = timezone.WEBEX_TIMEZONE_ID_TO_PYTZ_LABEL_MAP[int( kwargs['timezone'])] if self._started_at is None and kwargs.get('sessionStartTime'): self._started_at = time(kwargs['sessionStartTime']).set_tz(tz) if self._ended_at is None and kwargs.get('sessionEndTime'): self._ended_at = time(kwargs['sessionEndTime']).set_tz(tz) self.description = mpop(kwargs, 'description') or None self.session_key = mpop(kwargs, 'session_key', 'sessionKey') self.visibility = mpop( kwargs, 'listing', 'listStatus', fallback=account.meetings_must_be_unlisted and 'UNLISTED' or 'PUBLIC').strip().lower()
def __init__(self, account, **kwargs): super(Event,self).__init__() self.account = account self.title = nstrip(mpop(kwargs, 'title', 'sessionName','confName')) self._starts_at = mpop(kwargs,'starts_at','_starts_at') self._ends_at = mpop(kwargs,'ends_at','_ends_at') self._started_at = mpop(kwargs,'started_at','_started_at') self._ended_at = mpop(kwargs,'ended_at','_ended_at') if kwargs.get('timeZoneID'): # this comes from normal listing tz = timezone.WEBEX_TIMEZONE_ID_TO_PYTZ_LABEL_MAP[int(kwargs['timeZoneID'])] if self._starts_at is None and kwargs.get('startDate'): self._starts_at = time(kwargs['startDate'], tz) if self._ends_at is None and kwargs.get('endDate'): self._ends_at = time(kwargs['endDate'], tz) if kwargs.get('timezone'): # this comes form historical listing tz = timezone.WEBEX_TIMEZONE_ID_TO_PYTZ_LABEL_MAP[int(kwargs['timezone'])] if self._started_at is None and kwargs.get('sessionStartTime'): self._started_at = time(kwargs['sessionStartTime']).set_tz(tz) if self._ended_at is None and kwargs.get('sessionEndTime'): self._ended_at = time(kwargs['sessionEndTime']).set_tz(tz) self.description = mpop(kwargs, 'description') or None self.session_key = mpop(kwargs, 'session_key', 'sessionKey') self.visibility = mpop(kwargs, 'listing', 'listStatus', fallback=account.meetings_must_be_unlisted and 'UNLISTED' or 'PUBLIC').strip().lower()
def __new_init__(self, *args, **kwargs): self.env = (mpop(kwargs,'env','environment') or '').lower() in ('production','prod') and 'prod' or 'qa' self.__old_init__(*args, **kwargs)