From df5544cfe638bc2246f6821e6089dec7c1ad2494 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Sat, 19 Mar 2011 21:52:22 +0200 Subject: key propogation almost working --- demo/settings.py | 9 +++++++++ demo/templates/main.html | 3 +++ demo/urls.py | 4 +++- fb/context_processors.py | 5 +++++ fb/middleware.py | 5 +++++ fb/templates/fb_js.html | 10 ++++++++++ 6 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 fb/context_processors.py create mode 100644 fb/middleware.py create mode 100644 fb/templates/fb_js.html diff --git a/demo/settings.py b/demo/settings.py index d9858d2..218a774 100644 --- a/demo/settings.py +++ b/demo/settings.py @@ -71,6 +71,15 @@ TEMPLATE_LOADERS = ( # 'django.template.loaders.eggs.Loader', ) +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.core.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.request", + "fb.context_processors.fb_app_id", +) + MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff --git a/demo/templates/main.html b/demo/templates/main.html index 36c5da8..23a1ba2 100644 --- a/demo/templates/main.html +++ b/demo/templates/main.html @@ -6,5 +6,8 @@

django-fb

+ + {% include 'fb_js.html' %} + \ No newline at end of file diff --git a/demo/urls.py b/demo/urls.py index 8879afc..5b3c71e 100644 --- a/demo/urls.py +++ b/demo/urls.py @@ -1,11 +1,13 @@ from django.conf.urls.defaults import * from django.contrib import admin from django.http import HttpResponse +from django.template import Context, loader + admin.autodiscover() urlpatterns = patterns('', - (r'^$', lambda r: HttpResponse("demo base", mimetype="text/plain")), + (r'^$', lambda r: HttpResponse(loader.get_template('main.html').render(Context({})))), (r'^fb/', include('fb.urls')), (r'^admin/doc/', include('django.contrib.admindocs.urls')), diff --git a/fb/context_processors.py b/fb/context_processors.py new file mode 100644 index 0000000..92a9a0a --- /dev/null +++ b/fb/context_processors.py @@ -0,0 +1,5 @@ +from django.conf import settings + +def fb_app_id(request): + print 'bla' + return { settings.FACEBOOK_APP_ID } \ No newline at end of file diff --git a/fb/middleware.py b/fb/middleware.py new file mode 100644 index 0000000..cd2305d --- /dev/null +++ b/fb/middleware.py @@ -0,0 +1,5 @@ + +class DjangoFacebookMiddleware: + + def process_template_response(self, req, res): + \ No newline at end of file diff --git a/fb/templates/fb_js.html b/fb/templates/fb_js.html new file mode 100644 index 0000000..11969d2 --- /dev/null +++ b/fb/templates/fb_js.html @@ -0,0 +1,10 @@ +
+ + \ No newline at end of file -- cgit v1.3.1