Example refactor forcompose_tweet
method. #2
S'han modificat 1 arxius amb 4 adicions i 6 eliminacions
10
mastotuit.py
10
mastotuit.py
|
@ -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]
|
||||
)
|
||||
|
|
Loading…
Referencia en una nova incidència