예제 #1
0
파일: views.py 프로젝트: dusano/skram-si
def twitter_status_update(request):
    status_update_form = TwitterStatusUpdateForm(request.POST)
    if not status_update_form.is_valid():
        return HttpResponseBadRequest('Invalid form: ' + str(status_update_form.errors))
    
    status = status_update_form.cleaned_data['twitter_status'];
    logging.info('twitter.com/skramsi status update: ' + status)
    
    SkramSiTwitter.post_status_update(status)

    return HttpResponseRedirect(urlresolvers.reverse('skram.views.index'))
예제 #2
0
def latest_tweets(request):
    tweets = cache.get('tweets')

    if tweets:
        return {"tweets": tweets}

    try:
        tweets = SkramSiTwitter.get_latest_tweets()
    except twitter.TwitterError, e:
        logging.warning('Error accessing latest tweets. ' + str(e))
        return {}