def post_to_twitter(self, message=None):
consumer = oauth2.Consumer(key=conf.TWITTER_CONSUMER_KEY,<EOL>secret=conf.TWITTER_CONSUMER_SECRET)<EOL>token = oauth2.Token(key=conf.TWITTER_ACCESS_TOKEN, secret=conf.TWITTER_ACCESS_SECRET)<EOL>client = SimpleTwitterClient(consumer=consumer, token=token)<EOL>if not message:<EOL><INDENT>message = self.get_message()<EOL><DEDENT>hash_tag = '<STR_LIT>'<EOL>if conf.BASE_URL:<EOL><INDENT>permalink = urlparse.urljoin(conf.BASE_URL, reverse('<STR_LIT>', args=[self.pk]))<EOL>if len(message) + len(permalink) + len(hash_tag) > <NUM_LIT>:<EOL><INDENT>message = '<STR_LIT>' % (message[:<NUM_LIT>-<NUM_LIT:4>-len(hash_tag)-len(permalink)], permalink, hash_tag)<EOL><DEDENT>else:<EOL><INDENT>message = '<STR_LIT>' % (message, permalink, hash_tag) <EOL><DEDENT><DEDENT>else:<EOL><INDENT>if len(message) + len(hash_tag) > <NUM_LIT>:<EOL><INDENT>message = '<STR_LIT>' % (message[:<NUM_LIT>-<NUM_LIT:3>-len(hash_tag)], hash_tag)<EOL><DEDENT>else:<EOL><INDENT>message = '<STR_LIT>' % (message, hash_tag)<EOL><DEDENT><DEDENT>return client.update_status(message)<EOL>
Update twitter status, i.e., post a tweet