This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import User | |
from facebookconnect.models import FacebookProfile | |
from django.conf import settings | |
from django.core.urlresolvers import reverse | |
import facebook | |
from facebookconnect.utils import facebook_login_check, get_access_token | |
class FacebookConnectBackend: | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalize_file_path(path): | |
#assumptions: valid path does not start with '../' or '/..' | |
if path.startswith('../') or path.startswith('/..'): | |
return None #alternatively, raise an exception | |
#normalize all the double dots first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalize_file_path(path): | |
#assumptions: valid path does not start with '../' or '/..' | |
if path.startswith('../') or path.startswith('/..'): | |
return None | |
#normalize all the double dots first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"sports" :[{"name" :"basketball","id" :40,"leagues" :[{"name" :"National Basketball Assoc.","abbreviation" :"nba","id" :46,"groupId" :7,"shortName" :"NBA","events" :[{"id" :400277801,"date" :"2012-11-11T00:00:00Z","season" :{"year" :2013,"type" :2,"description" :"regular","startDate" :"2012-10-30T07:00:00Z","endDate" :"2013-04-18T06:59:59Z"},"timeValid" :true,"competitions" :[{"id" :400277801,"date" :"2012-11-11T00:00:00Z","stats" :{"attendance" :0},"competitors" :[{"type" :"team","score" :0,"homeAway" :"home","team" :{"id" :28,"homeAway" :"home","location" :"Toronto","name" :"Raptors","abbreviation" :"TOR","color" :"CE0F41","links" :{"api" :{"teams" :{"href" :"http://api.espn.com/v1/sports/basketball/nba/teams/28"}}},"record" :{"summary" :"1-4","wins" :1,"losses" :4,"overtimeLosses" :0,"ties" :0}}},{"type" :"team","score" :0,"homeAway" :"away","team" :{"id" :20,"homeAway" :"away","location" :"Philadelphia","name" :"76ers","abbreviation" :"PHI","color" :"000000","links" :{"api" :{"teams" :{"href" :"http://a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"sports" :[{"name" :"football","id" :20,"leagues" :[{"name" :"NCAA Football","abbreviation" :"college-football","id" :23,"groupId" :99,"shortName" :"NCAA Football","events" :[{"id" :323150130,"date" :"2012-11-10T17:00:00Z","season" :{"year" :2012,"type" :2,"description" :"regular","startDate" :"2012-08-28T07:00:00Z","endDate" :"2012-12-18T07:59:59Z"},"timeValid" :true,"competitions" :[{"id" :323150130,"date" :"2012-11-10T17:00:00Z","stats" :{"attendance" :0},"competitors" :[{"type" :"team","score" :28,"homeAway" :"home","team" :{"id" :130,"homeAway" :"home","location" :"Michigan","name" :"Wolverines","nickname" :"Michigan","abbreviation" :"MICH","color" :"001531","links" :{"api" :{"teams" :{"href" :"http://api.espn.com/v1/sports/football/college-football/teams/130"}}},"record" :{"summary" :"6-3","wins" :6,"losses" :3,"overtimeLosses" :0,"ties" :0}}},{"type" :"team","score" :31,"homeAway" :"away","team" :{"id" :77,"homeAway" :"away","location" :"Northwestern","name" :"Wildcats","nickname" :"N'western","abbre |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"sports": [{ | |
"name": "soccer", | |
"id": 600, | |
"leagues": [{ | |
"name": "Primera Divisi\u00F3n de Argentina", | |
"abbreviation": "arg.1", | |
"id": 745, | |
"groupId": 1, | |
"shortName": "Primera A", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
if socket.gethostname() == 'productionserver.com': | |
DEBUG = False | |
else: | |
DEBUG = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlpatterns = patterns('django.views.generic.simple', | |
(r'^foo/$', 'direct_to_template', {'template': 'foo_index.html'}), | |
(r'^foo/(?P<id>\d+)/$', 'direct_to_template', {'template': 'foo_detail.html'}), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
PROJECT_DIR = os.path.dirname(__file__) | |
... | |
STATIC_DOC_ROOT = os.path.join(PROJECT_DIR, "static") | |
... | |
TEMPLATE_DIRS = ( | |
os.path.join(PROJECT_DIR, "templates"), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2012 Roman Nurik + Nick Butcher | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |