Exemplo n.º 1
0
 def __init__(self, oauth_token=None, *args, **kwargs):
     super(Auth, self).__init__(*args,**kwargs)
     self.oauth_token = oauth_token
     
     #deprecated stuff
     self.api_key = mget(kwargs,'api_key','hapi_key','hapiKey')  # avaible for legacy usage
     self.id = mget(kwargs,'id','hub_id','portal_id','portalId')  # id only required for global api_keys
Exemplo n.º 2
0
 def calc_hashcode(kls, **kwargs):
     key = mget(kwargs,'remote_id', 'session_key', 'universal_key')
     if key: 
         source = key
     else:
         title = mget(kwargs,'title','subject')
         us_starts_at = kwargs.get('_time_starts_at',kwargs.get('starts_at',time(0)).us)
         us_ends_at = kwargs.get('_time_ends_at',kwargs.get('ends_at',time(0)).us)
         source = '%s|%s|%s'%(title,us_starts_at,us_ends_at)
     return int(int(hashlib.md5(source).hexdigest(),16)%2**31)
Exemplo n.º 3
0
 def __init__(self, organizer, **kwargs):
     super(Webinar, self).__init__()
     self.organizer = organizer
     self.key = mget(kwargs,'key','webinarKey')
     self.subject = mget(kwargs,'subject','name')
     self.description = kwargs.get('description')
     self.timezone = mget(kwargs, 'timezone', 'timeZone') or 'UTC'
     if kwargs.has_key('sessions'): self.sessions = kwargs['sessions']
     if kwargs.has_key('registrations'): self.registrations = kwargs['registrations']
     if kwargs.has_key('times') and not is_cached(self,'sessions'):
         extras = getdict(kwargs, 'scheduled','actual')
         self.sessions = [Session(webinar=self, **merge(span,extras)) for span in kwargs.get('times',[])]
Exemplo n.º 4
0
 def __init__(self, hub, **kwargs):
     super(Setting, self).__init__()
     self.hub = hub
     self.name = kwargs.get('name')
     self.value = kwargs.get('value')
     self.app_key = mget(kwargs,'app_key','appKey')
     self.created_at = ntime(ms=kwargs.get('createdAt')) or kwargs.get('created_at')
     self.updated_at = ntime(ms=kwargs.get('updatedAt')) or kwargs.get('updated_at')
     self.readonly = kwargs.get('readonly',False)
     hub_id = mget(kwargs,'hub_id','portal_id','portalId')
     if hub_id: 
         if not hub.id: hub.id = hub_id
         elif hub_id!=hub.id: raise Exception('wtf-- that shouldnt have happened -- hub.id=%s , hub_id=%s' % (hub.id, hub_id))
Exemplo n.º 5
0
 def __init__(self, organizer, **kwargs):
     super(Webinar, self).__init__()
     self.organizer = organizer
     self.key = mget(kwargs, 'key', 'webinarKey')
     self.subject = mget(kwargs, 'subject', 'name')
     self.description = kwargs.get('description')
     self.timezone = mget(kwargs, 'timezone', 'timeZone') or 'UTC'
     if kwargs.has_key('sessions'): self.sessions = kwargs['sessions']
     if kwargs.has_key('registrations'):
         self.registrations = kwargs['registrations']
     if kwargs.has_key('times') and not is_cached(self, 'sessions'):
         extras = getdict(kwargs, 'scheduled', 'actual')
         self.sessions = [
             Session(webinar=self, **merge(span, extras))
             for span in kwargs.get('times', [])
         ]
Exemplo n.º 6
0
 def __init__(self, **kwargs):
     super(Registrant, self).__init__()
     self.webinar = kwargs.get('webinar')
     self.session = kwargs.get('session')
     self.key = mget(kwargs, 'key', 'registrant_key', 'registrantKey')
     self.email = nlower(mget(kwargs, 'email', 'attendeeEmail'))
     self.first_name = mget(kwargs, 'first_name', 'firstName', 'first')
     self.last_name = mget(kwargs, 'last_name', 'lastName', 'last')
     if kwargs.get('name'): self.name = nstrip(kwargs.get('name'))
     self.registered_at = ntime(
         mget(kwargs, 'registered_at', 'registrationDate'))
     self.join_url = mget(kwargs, 'join_url', 'joinUrl')
     self.status = kwargs.get('status')
     self.viewings = kwargs.get('viewings', [])
     if not self.viewings and kwargs.get('attendance'):
         self.viewings = sort([(time(d['joinTime']), time(d['leaveTime']))
                               for d in kwargs['attendance']])
     if not self.viewings and (
             kwargs.get('duration') or kwargs.get('attendanceTimeInSeconds')
     ) and self.session and self.session.key and self.session.started_at:
         duration = kwargs.get(
             'duration') or kwargs.get('attendanceTimeInSeconds') and delta(
                 s=kwargs['attendanceTimeInSeconds'])
         self.viewings = [(self.session.started_at,
                           self.session.started_at + duration)]
Exemplo n.º 7
0
    def __init__(self, webinar, **kwargs):
        super(Session, self).__init__()
        self.webinar = webinar
        self.key = mget(kwargs,'sessionKey','key')
        self.attendant_count = mget(kwargs, 'attendant_count', 'registrantsAttended')
        if kwargs.has_key('attendees'): self.attendees = kwargs['attendees']

        actual = kwargs.get('actual')
        scheduled = kwargs.get('scheduled')
        self._starts_at = ntime(mget(kwargs,'starts_at','_starts_at') or scheduled and kwargs.get('startTime'))
        self._ends_at = ntime(mget(kwargs,'ends_at','_ends_at') or scheduled and kwargs.get('endTime'))
        self._started_at = ntime(mget(kwargs,'started_at','_started_at') or actual and kwargs.get('startTime'))
        self._ended_at = ntime(mget(kwargs,'ended_at','_ended_at') or actual and kwargs.get('endTime'))
Exemplo n.º 8
0
 def __init__(self, **kwargs):
     super(Registrant, self).__init__()
     self.webinar = kwargs.get('webinar')
     self.session = kwargs.get('session')
     self.key = mget(kwargs, 'key', 'registrant_key', 'registrantKey')
     self.email = nlower(mget(kwargs, 'email', 'attendeeEmail'))
     self.first_name = mget(kwargs, 'first_name', 'firstName', 'first')
     self.last_name = mget(kwargs, 'last_name', 'lastName', 'last')
     if kwargs.get('name'): self.name = nstrip(kwargs.get('name'))
     self.registered_at = ntime(mget(kwargs, 'registered_at', 'registrationDate'))
     self.join_url = mget(kwargs, 'join_url', 'joinUrl')
     self.status = kwargs.get('status')
     self.viewings = kwargs.get('viewings',[])
     if not self.viewings and kwargs.get('attendance'):
         self.viewings = sort([(time(d['joinTime']),time(d['leaveTime'])) for d in kwargs['attendance']])
     if not self.viewings and (kwargs.get('duration') or kwargs.get('attendanceTimeInSeconds')) and self.session and self.session.key and self.session.started_at:
         duration = kwargs.get('duration') or kwargs.get('attendanceTimeInSeconds') and delta(s=kwargs['attendanceTimeInSeconds'])
         self.viewings = [(self.session.started_at, self.session.started_at+duration)]
Exemplo n.º 9
0
    def __init__(self, webinar, **kwargs):
        super(Session, self).__init__()
        self.webinar = webinar
        self.key = mget(kwargs, 'sessionKey', 'key')
        self.attendant_count = mget(kwargs, 'attendant_count',
                                    'registrantsAttended')
        if kwargs.has_key('attendees'): self.attendees = kwargs['attendees']

        actual = kwargs.get('actual')
        scheduled = kwargs.get('scheduled')
        self._starts_at = ntime(
            mget(kwargs, 'starts_at', '_starts_at')
            or scheduled and kwargs.get('startTime'))
        self._ends_at = ntime(
            mget(kwargs, 'ends_at', '_ends_at')
            or scheduled and kwargs.get('endTime'))
        self._started_at = ntime(
            mget(kwargs, 'started_at', '_started_at')
            or actual and kwargs.get('startTime'))
        self._ended_at = ntime(
            mget(kwargs, 'ended_at', '_ended_at')
            or actual and kwargs.get('endTime'))
Exemplo n.º 10
0
 def __init__(self, **kwargs):
     super(Organizer, self).__init__()
     self.oauth = mget(kwargs,'oauth','oauth_token','access_token')
     self.key = mget(kwargs,'key','organizerKey','organizer_key')
     self.now = time()
     self.starts_at = kwargs.get('starts_at',None) or (self.now - DEFAULT_HISTORY_DELTA)