mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
Using story GUID's on top of permalinks.
This commit is contained in:
parent
fbe5c19ab5
commit
acd464af86
3 changed files with 11 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
import datetime
|
import datetime
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import sha
|
import hashlib
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
@ -137,8 +137,8 @@ class RegistrationManager(models.Manager):
|
||||||
username and a random salt.
|
username and a random salt.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
salt = sha.new(str(random.random())).hexdigest()[:5]
|
salt = hashlib.sha.new(str(random.random())).hexdigest()[:5]
|
||||||
activation_key = sha.new(salt+user.username).hexdigest()
|
activation_key = hashlib.sha.new(salt+user.username).hexdigest()
|
||||||
return self.create(user=user,
|
return self.create(user=user,
|
||||||
activation_key=activation_key)
|
activation_key=activation_key)
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,8 @@ class Feed(models.Model):
|
||||||
story_title = story.get('title'),
|
story_title = story.get('title'),
|
||||||
story_content = story_content,
|
story_content = story_content,
|
||||||
story_author = story.get('author'),
|
story_author = story.get('author'),
|
||||||
story_permalink = story.get('link')
|
story_permalink = story.get('link'),
|
||||||
|
story_guid = story.get('id')
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
ret_values[ENTRY_NEW] += 1
|
ret_values[ENTRY_NEW] += 1
|
||||||
|
@ -125,7 +126,8 @@ class Feed(models.Model):
|
||||||
story_content = diff.getDiff(),
|
story_content = diff.getDiff(),
|
||||||
story_original_content = original_content,
|
story_original_content = original_content,
|
||||||
story_author = story.get('author'),
|
story_author = story.get('author'),
|
||||||
story_permalink = story.get('link')
|
story_permalink = story.get('link'),
|
||||||
|
story_guid = story.get('id')
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
ret_values[ENTRY_UPDATED] += 1
|
ret_values[ENTRY_UPDATED] += 1
|
||||||
|
@ -172,7 +174,9 @@ class Feed(models.Model):
|
||||||
content_ratio = 0
|
content_ratio = 0
|
||||||
|
|
||||||
if story_pub_date > start_date and story_pub_date < end_date:
|
if story_pub_date > start_date and story_pub_date < end_date:
|
||||||
if story.get('link') == existing_story['story_permalink']:
|
if story.get('id') == existing_story['story_guid']:
|
||||||
|
story_in_system = existing_story
|
||||||
|
elif story.get('link') == existing_story['story_permalink']:
|
||||||
story_in_system = existing_story
|
story_in_system = existing_story
|
||||||
|
|
||||||
# Title distance + content distance, checking if story changed
|
# Title distance + content distance, checking if story changed
|
||||||
|
@ -254,6 +258,7 @@ class Story(models.Model):
|
||||||
blank=True)
|
blank=True)
|
||||||
story_author = models.CharField(max_length=255, null=True, blank=True)
|
story_author = models.CharField(max_length=255, null=True, blank=True)
|
||||||
story_permalink = models.CharField(max_length=1000)
|
story_permalink = models.CharField(max_length=1000)
|
||||||
|
story_guid = models.CharField(max_length=1000)
|
||||||
story_past_trim_date = models.BooleanField(default=False)
|
story_past_trim_date = models.BooleanField(default=False)
|
||||||
tags = models.ManyToManyField(Tag)
|
tags = models.ManyToManyField(Tag)
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB |
Loading…
Add table
Reference in a new issue