diff options
author | luxagraf <sng@luxagraf.net> | 2016-10-10 07:54:02 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2016-10-10 07:54:02 -0400 |
commit | 3982aeb761dabbf7ec84e51813bf9b07531d332a (patch) | |
tree | c4d3f27a5440866ff7b0b95d9a127afff471e9ab /app/syndication | |
parent | 1c656d42f8f00b7202621c1aa392d718dcc6c7cd (diff) |
rolled in some live changes
Diffstat (limited to 'app/syndication')
-rw-r--r-- | app/syndication/models.py | 2 | ||||
-rw-r--r-- | app/syndication/syndicators.py | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/app/syndication/models.py b/app/syndication/models.py index 2be7237..c348c1b 100644 --- a/app/syndication/models.py +++ b/app/syndication/models.py @@ -74,7 +74,7 @@ def post_save_events(sender, update_fields, created, instance, **kwargs): instance.status = 2 if item.name == "Twitter": print("calling function") - #post_to_twitter(instance.content_object, instance.content_type.name) + post_to_twitter(instance.content_object, instance.content_type.name) if item.name == "Flickr": if instance.content_type.name == "lux image": post_photo_to_flickr(instance.content_object) diff --git a/app/syndication/syndicators.py b/app/syndication/syndicators.py index 764f455..5f8762c 100644 --- a/app/syndication/syndicators.py +++ b/app/syndication/syndicators.py @@ -73,9 +73,10 @@ def post_to_twitter(obj, ctype): loop = loop+1 if loop == 3: break - soup.find_all('img').replaceWith("") + for t in soup.find_all('img'): + t.replaceWith("") # truncate message - if status.length > 140: + if len(status) > 140: try: status = status.split("|")[0] + obj.get_absolute_url() except: @@ -84,15 +85,12 @@ def post_to_twitter(obj, ctype): try: geo = t.reverse_geocode(lat=obj.latitude, lon=obj.longitude, accuracy=1500, granularity="city") geo_id = geo['result']['places'][0]['id'] - except: - pass - try: - status = t.update_status(status=status, media_ids=[img['media_id'] for img in imgs], place_id=geo_id) + tweet = t.update_status(status=status, media_ids=[img['media_id'] for img in imgs], place_id=geo_id) except: try: - status = t.update_status(status=status, media_ids=[img['media_id'] for img in imgs]) + tweet = t.update_status(status=status, media_ids=[img['media_id'] for img in imgs]) except: - status = t.update_status(status=status) + tweet = t.update_status(status=status) def post_photo_to_flickr(photo): |