summaryrefslogtreecommitdiffstats
path: root/fbconnect
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-05-09 00:57:43 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-05-09 00:57:43 -0400
commit5ec0ae6635bc9ece491c23b18507f2a558ce14e5 (patch)
tree3aa0948fea48310ddae4957547adc1804e13f21a /fbconnect
parent248ceb476de4f5504c1b8a5d0017223889690201 (diff)
downloadaskbot-5ec0ae6635bc9ece491c23b18507f2a558ce14e5.tar.gz
askbot-5ec0ae6635bc9ece491c23b18507f2a558ce14e5.tar.bz2
askbot-5ec0ae6635bc9ece491c23b18507f2a558ce14e5.zip
broken commit. will transfer last bits of settings to livesettings tomorrow
Diffstat (limited to 'fbconnect')
-rw-r--r--fbconnect/fb.py16
-rw-r--r--fbconnect/urls.py10
2 files changed, 14 insertions, 12 deletions
diff --git a/fbconnect/fb.py b/fbconnect/fb.py
index afcd8210..8d41c3a2 100644
--- a/fbconnect/fb.py
+++ b/fbconnect/fb.py
@@ -1,4 +1,4 @@
-from django.conf import settings
+from forum.conf import settings as forum_settings
from time import time
from datetime import datetime
from urllib import urlopen, urlencode
@@ -20,11 +20,11 @@ def generate_sig(values):
for key in sorted(values.keys()):
keys.append(key)
- signature = ''.join(['%s=%s' % (key, values[key]) for key in keys]) + settings.FB_SECRET
+ signature = ''.join(['%s=%s' % (key, values[key]) for key in keys]) + forum_settings.FB_SECRET
return hashlib.md5(signature).hexdigest()
def check_cookies_signature(cookies):
- API_KEY = settings.FB_API_KEY
+ API_KEY = forum_settings.FB_API_KEY
values = {}
@@ -37,10 +37,10 @@ def check_cookies_signature(cookies):
def get_user_data(cookies):
request_data = {
'method': 'Users.getInfo',
- 'api_key': settings.FB_API_KEY,
+ 'api_key': forum_settings.FB_API_KEY,
'call_id': time(),
'v': '1.0',
- 'uids': cookies[settings.FB_API_KEY + '_user'],
+ 'uids': cookies[forum_settings.FB_API_KEY + '_user'],
'fields': 'name,first_name,last_name',
'format': 'json',
}
@@ -52,7 +52,7 @@ def get_user_data(cookies):
def delete_cookies(response):
- API_KEY = settings.FB_API_KEY
+ API_KEY = forum_settings.FB_API_KEY
response.delete_cookie(API_KEY + '_user')
response.delete_cookie(API_KEY + '_session_key')
@@ -62,7 +62,7 @@ def delete_cookies(response):
response.delete_cookie('fbsetting_' + API_KEY)
def check_session_expiry(cookies):
- return datetime.fromtimestamp(float(cookies[settings.FB_API_KEY+'_expires'])) > datetime.now()
+ return datetime.fromtimestamp(float(cookies[forum_settings.FB_API_KEY+'_expires'])) > datetime.now()
STATES = {
'FIRSTTIMER': 1,
@@ -72,7 +72,7 @@ STATES = {
}
def get_user_state(request):
- API_KEY = settings.FB_API_KEY
+ API_KEY = forum_settings.FB_API_KEY
logging.debug('')
if API_KEY in request.COOKIES:
diff --git a/fbconnect/urls.py b/fbconnect/urls.py
index bf2d4364..81b0cb0f 100644
--- a/fbconnect/urls.py
+++ b/fbconnect/urls.py
@@ -1,13 +1,15 @@
from django.conf.urls.defaults import *
from django.utils.translation import ugettext as _
from django.views.generic.simple import direct_to_template
-from django.conf import settings
from views import signin, register
urlpatterns = patterns('',
- url(r'^xd_receiver$', direct_to_template, {'template': 'fbconnect/xd_receiver.html',\
- 'extra_context': {'APP_SHORT_NAME':settings.APP_SHORT_NAME}},\
- name='xd_receiver'),
+ url(
+ r'^xd_receiver$',
+ direct_to_template,
+ {'template': 'fbconnect/xd_receiver.html',},
+ name='xd_receiver'
+ ),
url(r'^%s$' % _('signin/'), signin, name="fb_signin"),
url(r'^%s%s$' % (_('signin/'), _('newquestion/')), signin, {'newquestion': True}, name="fb_signin_new_question"),