Example refactor forcompose_tweet method. #1

Fusionado
minkiu merged 1 commit from minkiu-master-patch-13794 into master 2021-10-19 15:42:14 +02:00

Veure arxiu

@ -51,9 +51,6 @@ def get_toot(title):
return tuit_text
def compose_tweet(tuit_text, with_images, is_reply):
tuit_max_length = 250 if len(tuit_text) > 280 else 275
tuit_text2 = ''
images_ids = []
if with_images:
@ -92,10 +89,11 @@ def compose_tweet(tuit_text, with_images, is_reply):
sys.exit(err)
# Compose tuit
tuit_text2 = ''
if len(tuit_text) > 280:
tuit_max_length = 250 if with_images else 275
# This means that the OG tweet is bigger than 280
# Thus we need to break it down in two
if tuit_max_length == 250:
tuit_text = '{0} (1/2)'.format(
tuit_text[:tuit_max_length].rsplit(' ', 1)[0]
)