Skip to content

Commit 4bdc16a

Browse files
leahchrishas35
authored andcommitted
removed elsewhere info view since nobody uses it :(
Signed-off-by: Chris Hasenpflug <[email protected]>
1 parent 5f7133e commit 4bdc16a

File tree

3 files changed

+10
-221
lines changed

3 files changed

+10
-221
lines changed

README.markdown

+8-87
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
django-elsewhere - Portable Social Networks for Django
1+
django-elsewhere - Social Network Links for Django
22
===================================
33

4-
Formerly Django-PSN.
4+
Formerly Django-PSN (Portable Social Networks) and originally created for Pownce.
55

66
Authors:
77
------------
@@ -23,20 +23,13 @@ A quick shortcut is to checkout the project directly into your Python path:
2323
About:
2424
------------
2525

26-
Django-elsewhere allows users of a social website to provide and display information about their
26+
Django-elsewhere allows users of a website to provide and display information about their
2727
other online social networks. The project was created to let Pownce users
2828
show their friends what other online social networks they participate in.
2929
The hyperlinks to other profiles make use of the XFN rel="me" standard [http://www.gmpg.org/xfn/] (http://www.gmpg.org/xfn/),
3030
which enables auto-discovery of social network profiles which the user has chosen to consolidate
31-
into a single identity. Hopefully it's also parsable by Plaxo's Online Identity Consolidator [http://www.plaxo.com/info/opensocialgraph] (http://www.plaxo.com/info/opensocialgraph).
31+
into a single identity.
3232

33-
In addition, Django-elsewhere provides a JSON response with the user's claimed URLs and friend/follower relationships
34-
(represented as user ids for graph edges in and edges out). An example can be found at /interface/elsewhere_info
35-
with params id=user_id or indent=username.
36-
37-
I copied this format from LiveJournal, guessing that it will be copied by other websites as well.
38-
I'm open to changing this format and updating Django-elsewhere accordingly. This data can
39-
be used to connect friends across online social networks, building a free social graph.
4033

4134
Dependencies:
4235
------------
@@ -45,13 +38,6 @@ Dependencies:
4538
* Django Contrib Auth, place 'django.contrib.auth' in INSTALLED_APPS setting
4639

4740

48-
To use elsewhere:
49-
-----------
50-
51-
1. Place the /elsewhere directory on your Python path.
52-
2. Add 'elsewhere' to your INSTALLED_APPS setting.
53-
4. To create the necessary database tables, from your project run the command: python manage.py syncdb
54-
5541
To use the sample views:
5642
------------------------
5743
Add the following to your urlconf:
@@ -60,83 +46,18 @@ Add the following to your urlconf:
6046

6147
For sample templates add the path to elsewhere/templates to your TEMPLATE_DIRS setting.
6248

49+
6350
About the models:
6451
-----------------
6552

66-
There are two chunks of information considered interesting to social network portability:
67-
68-
Edges In and Edges Out - These define 'friend' relationships between users.
69-
Claimed and Verified URLs - Assertions of a user's identity in other social networks.
70-
71-
Edges In and Out is application specific but fairly easy data to obtain for a site owner.
72-
73-
Identity URL assertions can be obtained through a GUI which can be mutually interesting to
74-
users and interesting to data collectors. Daniel Burka (Pownce designer) and I spent a lot of time thinking of how to gather these
75-
assertions from users. We decided that while online identities take one form to a data collector
76-
(a profile URL), users perceive online identity in three forms:
53+
For Django-elsewhere, the online profiles have been divided into three categories:
7754

7855
* Social Networks (online social site profiles)
79-
* Instant Messengers (screenname)
56+
* Instant Messengers (screennames)
8057
* Websites (can be used for other types of online profiles such as weblogs or OpenID providers)
8158

82-
We really wanted Pownce users to get immediate positive feedback for providing Pownce with their online identities.
83-
Pownce users are not only contributing to social graph data, but are also displaying links
84-
and profile data on their application profiles for their friends.
85-
86-
Generate elsewhere_info JSON:
87-
Add the following to your urlconf:
59+
You can create and edit these either in the Django admin or using Django forms.
8860

89-
(r'^interface/elsewhere_info/$', 'elsewhere.views.elsewhere_info'),
90-
91-
Customize the elsewhere_info view in elsewhere/views.py. Specifically, you will need to
92-
generate lists of edges in and edges out based on how your application handles friend relationships.
93-
94-
Expected Request for elsewhere_info
95-
96-
Given a numeric node id or node identifier, return JSON about the
97-
user, optionally with all related edges.
98-
99-
GET /interface/elsewhere_info?id=234234 # unique userid
100-
GET /interface/elsewhere_info?ident=brad # unique identifier (username / group name)
101-
Host: www.elsewhere-cooperating-site.com
102-
103-
arguments:
104-
id= # integer nodeid to query. this or 'ident' is required.
105-
ident= # string identifier to query. this or 'id' is required.
106-
want_edges=1 # optional: explicitly request/don't request edges_{in,out} (default whatever you want)
107-
108-
Expected Response for elsewhere_info
109-
110-
HTTP 200 OK
111-
Content-Type: text/json # server isn't picky; can be whatever
112-
113-
{
114-
"node_id": 239847283947,
115-
"node_ident": "brad",
116-
"node_type": {"person"|"group"|"openid"},
117-
"mbox_sha1sum": "f1d2d2f924e986ac86fdf7b36c94bcdf32beec15", # of "mailto:[email protected]", ONLY IF email is verified
118-
119-
"claimed_urls": [
120-
"mbox_sha1sum:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15", # if not verified.
121-
"http://facebook.com/profile?id=23423434",
122-
"aim:bradfitzpatrick",
123-
"http://bradfitz.com/",
124-
],
125-
126-
"verified_urls": [ # ONLY if proven with OpenID / facebook auth, etc...
127-
"http://facebook.com/profile?id=23423434",
128-
}
129-
130-
"edges_out" : [ # all edges out, whether dest nodes are people _or_ groups.
131-
1,
132-
2,
133-
5,
134-
10,
135-
],
136-
"edges_in":[ # all edges out, whether source nodes are people _or_ groups.
137-
8,
138-
],
139-
};
14061

14162
Other resources:
14263
----------------

elsewhere/profile.py

-88
This file was deleted.

elsewhere/views.py

+2-46
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseServerError, Http404
1+
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseServerError
22
from django.template import RequestContext
3-
from django.contrib.auth.models import User
43
from django.contrib.auth.decorators import login_required
54
from django.shortcuts import render_to_response
65

7-
from elsewhere.profile import PortableProfile
86
from elsewhere.models import *
97
from elsewhere.forms import *
108

@@ -55,46 +53,4 @@ def example(request):
5553

5654
return render_to_response('elsewhere/example.html', {
5755
'sn_form': sn_form, 'im_form': im_form, 'w_form': w_form,
58-
}, context_instance=RequestContext(request))
59-
60-
def elsewhere_info(request):
61-
if request.method != 'GET':
62-
return HttpResponseServerError
63-
64-
# Find the requested user
65-
if 'id' in request.GET:
66-
try:
67-
u = User.objects.get(id=request.GET['id'])
68-
except:
69-
raise Http404('Invalid id: %s' % request.GET['id'])
70-
elif 'ident' in request.GET:
71-
try:
72-
u = User.objects.get(username__exact=request.GET['ident'])
73-
except:
74-
raise Http404('Invalid ident: %s' % request.GET['ident'])
75-
else:
76-
raise Http404("Must specify user id as 'id' or username as 'ident'.")
77-
78-
profile = PortableProfile(u)
79-
80-
# Friend graph edges are returned by default.
81-
# To ignore the graph edges, there is an optional request param want_edges=0
82-
want_edges = True
83-
try:
84-
if 'want_edges' in request.GET and int(request.GET['want_edges']) == 0:
85-
want_edges = False
86-
except:
87-
pass
88-
89-
if want_edges:
90-
# Provide custom code here to set the edges in / edges out for your
91-
# site's friend relationships
92-
edges_in = []
93-
profile.edges_in = edges_in
94-
95-
edges_out = []
96-
profile.edges_out = edges_out
97-
98-
# return the profile data as JSON
99-
json = profile.get_json(want_edges)
100-
return HttpResponse(json)
56+
}, context_instance=RequestContext(request))

0 commit comments

Comments
 (0)