diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/build.py | 2 | ||||
-rw-r--r-- | app/src/models.py | 4 | ||||
-rw-r--r-- | app/syndication/models.py | 2 | ||||
-rw-r--r-- | app/syndication/syndicators.py | 14 |
4 files changed, 10 insertions, 12 deletions
diff --git a/app/src/build.py b/app/src/build.py index ec79458..e6119e7 100644 --- a/app/src/build.py +++ b/app/src/build.py @@ -38,7 +38,7 @@ class BuildSrc(BuildNew): def builder(): - j = BuildSrc("src", "entry") + j = BuildSrc("src", "post") j.build() diff --git a/app/src/models.py b/app/src/models.py index ce78c24..fc0a5fc 100644 --- a/app/src/models.py +++ b/app/src/models.py @@ -74,7 +74,7 @@ class Post(models.Model): def save(self): md = image_url_replace(self.body_markdown) self.body_html = markdown_to_html(md) - super(Entry, self).save() + super(Post, self).save() def get_upload_path(self, filename): @@ -160,7 +160,7 @@ class SrcSitemap(Sitemap): def items(self): return list(chain( - Entry.objects.all(), + Post.objects.all(), Book.objects.all(), Topic.objects.all() )) 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): |