mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Removing unused south calls.
This commit is contained in:
parent
721779b357
commit
7f38f64447
7 changed files with 8 additions and 114 deletions
|
@ -1,2 +1,2 @@
|
|||
exclude = '{$exclude,*.tgz,*.gz,static/*.js,static/*.css}'
|
||||
excludeDirectories = "{$excludeDirectories,logs,data,clients/android,media/fonts,node_modules,venv,fonts,clients}"
|
||||
excludeDirectories = "{$excludeDirectories,logs,data,clients/android,media/fonts,node_modules,venv,fonts,clients,docker}"
|
||||
|
|
|
@ -18,10 +18,6 @@ from utils import log as logging
|
|||
from utils.feed_functions import timelimit
|
||||
from utils.feed_functions import add_object_to_folder
|
||||
|
||||
from south.modelsinspector import add_introspection_rules
|
||||
add_introspection_rules([], ["^oauth2client\.django_orm\.FlowField"])
|
||||
add_introspection_rules([], ["^oauth2client\.django_orm\.CredentialsField"])
|
||||
|
||||
|
||||
class OAuthToken(models.Model):
|
||||
user = models.OneToOneField(User, null=True, blank=True)
|
||||
|
|
|
@ -5,10 +5,8 @@ from oauth2_provider import views as op_views
|
|||
urlpatterns = patterns('',
|
||||
url(r'^twitter_connect/?$', views.twitter_connect, name='twitter-connect'),
|
||||
url(r'^facebook_connect/?$', views.facebook_connect, name='facebook-connect'),
|
||||
url(r'^appdotnet_connect/?$', views.appdotnet_connect, name='appdotnet-connect'),
|
||||
url(r'^twitter_disconnect/?$', views.twitter_disconnect, name='twitter-disconnect'),
|
||||
url(r'^facebook_disconnect/?$', views.facebook_disconnect, name='facebook-disconnect'),
|
||||
url(r'^appdotnet_disconnect/?$', views.appdotnet_disconnect, name='appdotnet-disconnect'),
|
||||
url(r'^follow_twitter_account/?$', views.follow_twitter_account, name='social-follow-twitter'),
|
||||
url(r'^unfollow_twitter_account/?$', views.unfollow_twitter_account, name='social-unfollow-twitter'),
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ def twitter_connect(request):
|
|||
twitter_consumer_key = settings.TWITTER_CONSUMER_KEY
|
||||
twitter_consumer_secret = settings.TWITTER_CONSUMER_SECRET
|
||||
|
||||
oauth_token = request.REQUEST.get('oauth_token')
|
||||
oauth_verifier = request.REQUEST.get('oauth_verifier')
|
||||
denied = request.REQUEST.get('denied')
|
||||
oauth_token = request.POST.get('oauth_token')
|
||||
oauth_verifier = request.POST.get('oauth_verifier')
|
||||
denied = request.POST.get('denied')
|
||||
if denied:
|
||||
logging.user(request, "~BB~FRDenied Twitter connect")
|
||||
return {'error': 'Denied! Try connecting again.'}
|
||||
|
@ -94,7 +94,7 @@ def facebook_connect(request):
|
|||
"display": "popup",
|
||||
}
|
||||
|
||||
verification_code = request.REQUEST.get('code')
|
||||
verification_code = request.POST.get('code')
|
||||
if verification_code:
|
||||
args["client_secret"] = facebook_secret
|
||||
args["code"] = verification_code
|
||||
|
@ -136,72 +136,15 @@ def facebook_connect(request):
|
|||
|
||||
logging.user(request, "~BB~FRFinishing Facebook connect")
|
||||
return {}
|
||||
elif request.REQUEST.get('error'):
|
||||
logging.user(request, "~BB~FRFailed Facebook connect, error: %s" % request.REQUEST.get('error'))
|
||||
return {'error': '%s... Try connecting again.' % request.REQUEST.get('error')}
|
||||
elif request.POST.get('error'):
|
||||
logging.user(request, "~BB~FRFailed Facebook connect, error: %s" % request.POST.get('error'))
|
||||
return {'error': '%s... Try connecting again.' % request.POST.get('error')}
|
||||
else:
|
||||
# Start the OAuth process
|
||||
logging.user(request, "~BB~FRStarting Facebook connect")
|
||||
url = "https://www.facebook.com/dialog/oauth?" + urllib.urlencode(args)
|
||||
return {'next': url}
|
||||
|
||||
@login_required
|
||||
@render_to('social/social_connect.xhtml')
|
||||
def appdotnet_connect(request):
|
||||
domain = Site.objects.get_current().domain
|
||||
args = {
|
||||
"client_id": settings.APPDOTNET_CLIENTID,
|
||||
"client_secret": settings.APPDOTNET_SECRET,
|
||||
"redirect_uri": "https://" + domain +
|
||||
reverse('appdotnet-connect'),
|
||||
"scope": ["email", "write_post", "follow"],
|
||||
}
|
||||
|
||||
oauth_code = request.REQUEST.get('code')
|
||||
denied = request.REQUEST.get('denied')
|
||||
if denied:
|
||||
logging.user(request, "~BB~FRDenied App.net connect")
|
||||
return {'error': 'Denied! Try connecting again.'}
|
||||
elif oauth_code:
|
||||
try:
|
||||
adn_auth = appdotnet.Appdotnet(**args)
|
||||
response = adn_auth.getAuthResponse(oauth_code)
|
||||
adn_resp = json.decode(response)
|
||||
access_token = adn_resp['access_token']
|
||||
adn_userid = adn_resp['user_id']
|
||||
except (IOError):
|
||||
logging.user(request, "~BB~FRFailed App.net connect")
|
||||
return dict(error="App.net has returned an error. Try connecting again.")
|
||||
|
||||
# Be sure that two people aren't using the same Twitter account.
|
||||
existing_user = MSocialServices.objects.filter(appdotnet_uid=unicode(adn_userid))
|
||||
if existing_user and existing_user[0].user_id != request.user.pk:
|
||||
try:
|
||||
user = User.objects.get(pk=existing_user[0].user_id)
|
||||
logging.user(request, "~BB~FRFailed App.net connect, another user: %s" % user.username)
|
||||
return dict(error=("Another user (%s, %s) has "
|
||||
"already connected with those App.net credentials."
|
||||
% (user.username, user.email or "no email")))
|
||||
except User.DoesNotExist:
|
||||
existing_user.delete()
|
||||
|
||||
social_services = MSocialServices.get_user(request.user.pk)
|
||||
social_services.appdotnet_uid = unicode(adn_userid)
|
||||
social_services.appdotnet_access_token = access_token
|
||||
social_services.syncing_appdotnet = True
|
||||
social_services.save()
|
||||
|
||||
SyncAppdotnetFriends.delay(user_id=request.user.pk)
|
||||
|
||||
logging.user(request, "~BB~FRFinishing App.net connect")
|
||||
return {}
|
||||
else:
|
||||
# Start the OAuth process
|
||||
adn_auth = appdotnet.Appdotnet(**args)
|
||||
auth_url = adn_auth.generateAuthUrl()
|
||||
logging.user(request, "~BB~FRStarting App.net connect")
|
||||
return {'next': auth_url}
|
||||
|
||||
@ajax_login_required
|
||||
def twitter_disconnect(request):
|
||||
logging.user(request, "~BB~FRDisconnecting Twitter")
|
||||
|
|
|
@ -271,7 +271,6 @@ ROOT_URLCONF = 'urls'
|
|||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
LOGGING_LOG_SQL = True
|
||||
APPEND_SLASH = False
|
||||
SOUTH_TESTS_MIGRATE = False
|
||||
SESSION_ENGINE = 'redis_sessions.session'
|
||||
TEST_RUNNER = "utils.testrunner.TestRunner"
|
||||
SESSION_COOKIE_NAME = 'newsblur_sessionid'
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
from django.db import models
|
||||
|
||||
from south.modelsinspector import add_introspection_rules
|
||||
add_introspection_rules([], ["^utils\.compressed_textfield\.StoryField"])
|
||||
|
||||
def uncompress_string(s):
|
||||
'''helper function to reverse django.utils.text.compress_string'''
|
||||
import cStringIO, gzip
|
||||
try:
|
||||
zbuf = cStringIO.StringIO(s)
|
||||
zfile = gzip.GzipFile(fileobj=zbuf)
|
||||
ret = zfile.read()
|
||||
zfile.close()
|
||||
except:
|
||||
ret = s
|
||||
return ret
|
||||
|
||||
class StoryField(models.TextField):
|
||||
|
||||
__metaclass__ = models.SubfieldBase
|
||||
|
||||
def to_python(self, value):
|
||||
|
||||
if not value:
|
||||
return None
|
||||
|
||||
# print 'From DB: %s %s' % (len(value), value[:25],)
|
||||
try:
|
||||
return unicode(value.decode('base64').decode('zlib'))
|
||||
except:
|
||||
return value
|
||||
|
||||
def get_prep_save(self, value):
|
||||
|
||||
if value:
|
||||
# print "Pre To DB: %s %s" % (len(value), value[:25])
|
||||
value = value.encode('zlib').encode('base64')
|
||||
# print "Post To DB: %s %s" % (len(value), value[:25])
|
||||
|
||||
return super(StoryField, self).get_prep_save(value)
|
|
@ -1,8 +1,6 @@
|
|||
from django.db.models import OneToOneField
|
||||
from django.db.models.fields.related import SingleRelatedObjectDescriptor
|
||||
|
||||
from south.modelsinspector import add_introspection_rules
|
||||
add_introspection_rules([], ["^utils\.fields\.AutoOneToOneField"])
|
||||
|
||||
class AutoSingleRelatedObjectDescriptor(SingleRelatedObjectDescriptor):
|
||||
def __get__(self, instance, instance_type=None):
|
||||
|
|
Loading…
Add table
Reference in a new issue