Esempio n. 1
0
    def get(self, lunch_id):
        user = self.current_user
        lunch = Lunch.get(lunch_id)
        lunch.add_participant(user.id)

        participants = lunch.participants

        handles = []
        for participant in participants:
            handles.append(participant.handle)

        url = "http://lunchspire.com/lunch/%s #lspire" % lunch.id
        message = "Joining @%s for lunch %s" % (', @'.join(handles), url)

        if len(message) > 140:
            message = "Joining @%s for lunch %s" % (handles[0], url)

        access_token= {'key': user.access_key, 'secret': user.access_secret}

        self.twitter_request(
            "/statuses/update",
            post_args={"status": message},
            access_token=access_token,
            callback=self.async_callback(self.finish))
        self.redirect('/lunch/%s' % lunch.id)
Esempio n. 2
0
 def get(self, lunch_id):
     instance = Lunch.get(lunch_id)
     if not instance:
         self.redirect('/lunch/create')
     params = {'lunch': instance}
     self.render('lunch.html', **params)