def _tweet_for_template(tweet, https=False):
 data = json.loads(tweet.raw_json)
 parsed_date = parsedate(data['created_at'])
 date = datetime(*parsed_date[0:6])
 if settings.CC_SHOW_REPLIES:
  replies = _get_tweets(limit=0, reply_to=tweet, https=https)
 else:
  replies = None
 if ('from_user' in data):
  user_data = data
  from_user = data['from_user']
 else:
  user_data = data['user']
  from_user = user_data['screen_name']
 if https:
  img = bleach.clean(user_data['profile_image_url_https'])
 else:
  img = bleach.clean(user_data['profile_image_url'])
 return {'profile_img': img, 'user': from_user, 'text': bleach.clean(data['text']), 'id': tweet.pk, 'date': date, 'reply_count': (len(replies) if replies else 0), 'replies': replies, 'reply_to': (tweet.reply_to and tweet.reply_to.pk), 'hidden': tweet.hidden}

def _tweet_for_template ( tweet , https = False ) : data = json . loads ( tweet . raw_json ) parsed_date = parsedate ( data [ 'created_at' ] ) date = datetime ( * parsed_date [ 0 : 6 ] ) if settings . CC_SHOW_REPLIES : replies = _get_tweets ( limit = 0 , reply_to = tweet , https = https ) else : replies = None if ( 'from_user' in data ) : user_data = data from_user = data [ 'from_user' ] else : user_data = data [ 'user' ] from_user = user_data [ 'screen_name' ] if https : img = bleach . clean ( user_data [ 'profile_image_url_https' ] ) else : img = bleach . clean ( user_data [ 'profile_image_url' ] ) return { 'profile_img' : img , 'user' : from_user , 'text' : bleach . clean ( data [ 'text' ] ) , 'id' : tweet . pk , 'date' : date , 'reply_count' : ( len ( replies ) if replies else 0 ) , 'replies' : replies , 'reply_to' : ( tweet . reply_to and tweet . reply_to . pk ) , 'hidden' : tweet . hidden }
return the dict needed for tweets .