mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Returning object on save because mongoengine 0.8.1 no longer automatically returns the object on create.
This commit is contained in:
parent
e16308f2d9
commit
ded52bf397
3 changed files with 9 additions and 4 deletions
|
@ -1483,7 +1483,7 @@ class MFeedIcon(mongo.Document):
|
|||
if self.icon_url:
|
||||
self.icon_url = unicode(self.icon_url)
|
||||
try:
|
||||
super(MFeedIcon, self).save(*args, **kwargs)
|
||||
return super(MFeedIcon, self).save(*args, **kwargs)
|
||||
except (IntegrityError, OperationError):
|
||||
# print "Error on Icon: %s" % e
|
||||
if hasattr(self, '_id'): self.delete()
|
||||
|
@ -1501,7 +1501,7 @@ class MFeedPage(mongo.Document):
|
|||
def save(self, *args, **kwargs):
|
||||
if self.page_data:
|
||||
self.page_data = zlib.compress(self.page_data)
|
||||
super(MFeedPage, self).save(*args, **kwargs)
|
||||
return super(MFeedPage, self).save(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def get_data(cls, feed_id):
|
||||
|
@ -1589,6 +1589,8 @@ class MStory(mongo.Document):
|
|||
super(MStory, self).save(*args, **kwargs)
|
||||
|
||||
self.sync_redis()
|
||||
|
||||
return self
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
self.remove_from_redis()
|
||||
|
@ -1749,7 +1751,7 @@ class MStarredStory(mongo.Document):
|
|||
self.story_original_content = None
|
||||
self.story_hash = self.feed_guid_hash
|
||||
|
||||
super(MStarredStory, self).save(*args, **kwargs)
|
||||
return super(MStarredStory, self).save(*args, **kwargs)
|
||||
|
||||
# self.index_for_search()
|
||||
|
||||
|
|
|
@ -165,6 +165,8 @@ class MSocialProfile(mongo.Document):
|
|||
if self.user_id not in self.following_user_ids:
|
||||
self.follow_user(self.user_id, force=True)
|
||||
self.count_follows()
|
||||
|
||||
return self
|
||||
|
||||
@property
|
||||
def blurblog_url(self):
|
||||
|
@ -1300,6 +1302,7 @@ class MSharedStory(mongo.Document):
|
|||
story_title=self.story_title,
|
||||
comments=self.comments, story_feed_id=self.story_feed_id,
|
||||
story_id=self.story_guid, share_date=self.shared_date)
|
||||
return self
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
MActivity.remove_shared_story(user_id=self.user_id, story_feed_id=self.story_feed_id,
|
||||
|
|
|
@ -530,7 +530,7 @@ def mark_story_as_shared(request):
|
|||
"story_author_name": story.story_author_name,
|
||||
"story_tags": story.story_tags,
|
||||
"story_date": story.story_date,
|
||||
|
||||
"story_db_id": story.id,
|
||||
"user_id": request.user.pk,
|
||||
"comments": comments,
|
||||
"has_comments": bool(comments),
|
||||
|
|
Loading…
Add table
Reference in a new issue