Permalink
Browse files

Merge branch 'master' into search

* master: (1171 commits)
  Fixing repeating friend finding check in both intro and friends dialog.
  Saving references to visible feeds when reading by folder.
  Major refactor of ios feed list. No longer relies on fragile locations dictionary.
  No more error messages on deploying new celery/gunicorn. Also adding NUMA cancellation support to mongo db server.
  Fixing ios classifiers in river view.
  Adding beta search (only titles and authors for now) for staff only.
  Updating enterprise distribution ipa.
  Fixing crash when mis-counting feeds. Correcting height of font popover on iphone. Adding horizontal bounce to story page control.
  Doubling resync likelihood.
  Clearing out old read stories for 1% of all feed fetches with new stories.
  Adding unread cutoff to redis sync.
  Syncing redis keys by feed_id for read stories.
  Adding a sync all redis for user stories to be run in a migration.
  Turning off deletion of old stories until the db can be prepped.
  Adding index for read story deletion.
  Deleting old stories.
  Typo in delete read stories log.
  Typo in delete read stories log.
  Typo in delete read stories log.
  Deleting old user stories again. This time going out to 5 times the unread bounds.
  ...

Conflicts:
	local_settings.py.template
	settings.py
  • Loading branch information...
2 parents bb1d654 + 833edd1 commit 93e3a76087609923e50af8394c1025fd4fa62e4b @samuelclay committed Dec 20, 2012
Showing 1,528 changed files with 167,578 additions and 44,954 deletions.
View
@@ -4,6 +4,8 @@ logs/*.pid
*.pyc
static/*
local_settings.py
+celerybeat-schedule
+celerybeat.pid
media/iphone/NewsBlur/build
media/iphone/build
build/
@@ -20,4 +22,32 @@ xcuserdata
*.mode1v3
*.pbxuser
media/maintenance.html
-config/settings
+media/maintenance.html.unused
+config/settings
+static.tgz
+media/css/circular
+config/settings
+config/secrets
+
+# ----------------------
+# Android
+# ----------------------
+# built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
+
+# generated files
+media/android/NewsBlur/bin/
+media/android/NewsBlur/gen/
+media/android/NewsBlurTest/bin/
+media/android/NewsBlurTest/gen/
+
+# Local configuration file (sdk path, etc)
+media/android/NewsBlur/local.properties
+media/android/NewsBlurTest/local.properties
View
@@ -37,6 +37,11 @@ class MClassifierTitle(mongo.Document):
'indexes': [('user_id', 'feed_id'), 'feed_id', ('user_id', 'social_user_id'), 'social_user_id'],
'allow_inheritance': False,
}
+
+ def __unicode__(self):
+ user = User.objects.get(pk=self.user_id)
+ return "%s - %s/%s: (%s) %s" % (user, self.feed_id, self.social_user_id, self.score, self.title[:30])
+
class MClassifierAuthor(mongo.Document):
user_id = mongo.IntField(unique_with=('feed_id', 'social_user_id', 'author'))
@@ -51,6 +56,10 @@ class MClassifierAuthor(mongo.Document):
'indexes': [('user_id', 'feed_id'), 'feed_id', ('user_id', 'social_user_id'), 'social_user_id'],
'allow_inheritance': False,
}
+
+ def __unicode__(self):
+ user = User.objects.get(pk=self.user_id)
+ return "%s - %s/%s: (%s) %s" % (user, self.feed_id, self.social_user_id, self.score, self.author[:30])
class MClassifierTag(mongo.Document):
user_id = mongo.IntField(unique_with=('feed_id', 'social_user_id', 'tag'))
@@ -66,6 +75,10 @@ class MClassifierTag(mongo.Document):
'allow_inheritance': False,
}
+ def __unicode__(self):
+ user = User.objects.get(pk=self.user_id)
+ return "%s - %s/%s: (%s) %s" % (user, self.feed_id, self.social_user_id, self.score, self.tag[:30])
+
class MClassifierFeed(mongo.Document):
user_id = mongo.IntField(unique_with=('feed_id', 'social_user_id'))
@@ -80,10 +93,20 @@ class MClassifierFeed(mongo.Document):
'allow_inheritance': False,
}
+ def __unicode__(self):
+ user = User.objects.get(pk=self.user_id)
+ if self.feed_id:
+ feed = Feed.get_by_id(self.feed_id)
+ else:
+ feed = User.objects.get(pk=self.social_user_id)
+ return "%s - %s/%s: (%s) %s" % (user, self.feed_id, self.social_user_id, self.score, feed)
+
def apply_classifier_titles(classifiers, story):
score = 0
for classifier in classifiers:
+ if classifier.feed_id != story['story_feed_id']:
+ continue
if classifier.title.lower() in story['story_title'].lower():
# print 'Titles: (%s) %s -- %s' % (classifier.title in story['story_title'], classifier.title, story['story_title'])
score = classifier.score
@@ -93,6 +116,8 @@ def apply_classifier_titles(classifiers, story):
def apply_classifier_authors(classifiers, story):
score = 0
for classifier in classifiers:
+ if classifier.feed_id != story['story_feed_id']:
+ continue
if story.get('story_authors') and classifier.author == story.get('story_authors'):
# print 'Authors: %s -- %s' % (classifier.author, story['story_authors'])
score = classifier.score
@@ -102,19 +127,29 @@ def apply_classifier_authors(classifiers, story):
def apply_classifier_tags(classifiers, story):
score = 0
for classifier in classifiers:
+ if classifier.feed_id != story['story_feed_id']:
+ continue
if story['story_tags'] and classifier.tag in story['story_tags']:
# print 'Tags: (%s-%s) %s -- %s' % (classifier.tag in story['story_tags'], classifier.score, classifier.tag, story['story_tags'])
score = classifier.score
if score > 0: return classifier.score
return score
-def apply_classifier_feeds(classifiers, feed, social_user_id=None):
- feed_id = feed if isinstance(feed, int) else feed.pk
+def apply_classifier_feeds(classifiers, feed, social_user_ids=None):
+ if not feed and not social_user_ids: return 0
+ feed_id = None
+ if feed:
+ feed_id = feed if isinstance(feed, int) else feed.pk
+
+ if social_user_ids and not isinstance(social_user_ids, list):
+ social_user_ids = [social_user_ids]
+
for classifier in classifiers:
if classifier.feed_id == feed_id:
# print 'Feeds: %s -- %s' % (classifier.feed_id, feed.pk)
return classifier.score
- if social_user_id and not classifier.feed_id and social_user_id == classifier.social_user_id:
+ if (social_user_ids and not classifier.feed_id and
+ classifier.social_user_id in social_user_ids):
return classifier.score
return 0
View
@@ -1,7 +1,9 @@
+import redis
from utils import log as logging
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_POST
-from mongoengine.queryset import OperationError
+from django.conf import settings
+# from mongoengine.queryset import OperationError
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
@@ -80,7 +82,6 @@ def _save_classifier(ClassifierCls, content_type):
classifier_dict['feed_id'] = post_content
# try:
classifier, created = ClassifierCls.objects.get_or_create(**classifier_dict)
- print classifier_dict, classifier, created
# except OperationError:
# continue
if score == 0:
@@ -99,6 +100,9 @@ def _save_classifier(ClassifierCls, content_type):
_save_classifier(MClassifierTitle, 'title')
_save_classifier(MClassifierFeed, 'feed')
+ r = redis.Redis(connection_pool=settings.REDIS_POOL)
+ r.publish(request.user.username, 'feed:%s' % feed_id)
+
response = dict(code=code, message=message, payload=payload)
return response
View
@@ -7,4 +7,6 @@
url(r'^signup', views.signup, name='api-signup'),
url(r'^add_site_load_script/(?P<token>\w+)', views.add_site_load_script, name='api-add-site-load-script'),
url(r'^add_site/(?P<token>\w+)', views.add_site, name='api-add-site'),
+ url(r'^check_share_on_site/(?P<token>\w+)', views.check_share_on_site, name='api-check-share-on-site'),
+ url(r'^share_story/(?P<token>\w+)', views.share_story, name='api-share-story'),
)
Oops, something went wrong.

0 comments on commit 93e3a76

Please sign in to comment.