Пример #1
0
 def add_user_to_wavelet(self, user, short_url):
   wavelet = self.get_wavelet_from_shorturl(short_url)
   
   if not wavelet.visible:
     raise Exception, 'unable to join that wavelet'
   
   if user.username in wavelet.users_added:
     raise Exception, 'already in that wavelet (check queue)'
   
   task = TaskQueue(user=user, op_type='add_participant')
   task.wavelet_key = wavelet.key()
   task.wavelet_id = wavelet.wavelet_id
   task.wave_id = wavelet.wave_id
   task.wavelet_title = wavelet.title
   task.participant_id = user.wave_address
   task.put()
   
   wavelet.users_added.append(user.username)
   wavelet.put()
Пример #2
0
 def on_cron_event(self, properties, context):
   handler = TaskHandler(context)
   for task in TaskQueue.all():
     handler.do(task)
     task.delete()