def format_tweet(oneliner, baseurl):
    long_url = baseurl + oneliner.get_absolute_url()
    from oneliners.shorturl import get_goo_gl

    url = get_goo_gl(long_url) or long_url
    message = '{} {}'.format(url, oneliner.line)
    return message
Example #2
0
def format_tweet(oneliner, baseurl):
    long_url = baseurl + oneliner.get_absolute_url()
    from oneliners.shorturl import get_goo_gl

    url = get_goo_gl(long_url) or long_url
    message = "%s %s" % (url, oneliner.line)
    return message
Example #3
0
def tweet(oneliner, force=False, test=False):
    if not oneliner.was_tweeted or force:
        long_url = 'http://bashoneliners.com/main/oneliner/%d' % oneliner.pk
        from oneliners.shorturl import get_goo_gl
        url = get_goo_gl(long_url) or long_url
        message = '%s %s' % (
                url,
                oneliner.line,
                )
        from oneliners.tweet import tweet as send_tweet
        result = send_tweet(message, test=test)
        if result:
            oneliner.was_tweeted = True
            oneliner.save()
            return result