mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Sanity check on story.id->story_story_guid convert.
This commit is contained in:
parent
80f921996e
commit
7c994d368a
1 changed files with 5 additions and 1 deletions
|
@ -6,6 +6,7 @@ from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifie
|
|||
from apps.analyzer.models import ClassifierTitle, ClassifierAuthor, ClassifierFeed, ClassifierTag
|
||||
import mongoengine, pymongo
|
||||
import sys
|
||||
from mongoengine.queryset import OperationError
|
||||
from utils import json
|
||||
|
||||
MONGO_DB = settings.MONGO_DB
|
||||
|
@ -180,7 +181,10 @@ def reindex_stories():
|
|||
if isinstance(story.id, unicode):
|
||||
story.story_guid = story.id
|
||||
story.id = pymongo.objectid.ObjectId()
|
||||
story.save()
|
||||
try:
|
||||
story.save()
|
||||
except OperationError, e:
|
||||
print " ***> OperationError: %s" % e
|
||||
db.stories.remove({"_id": story.story_guid})
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Reference in a new issue