Merge lp:~terrycojones/tickery/remove-api-806704 into lp:tickery

Proposed by Terry Jones
Status: Merged
Approved by: Jamu Kakar
Approved revision: 16
Merged at revision: 17
Proposed branch: lp:~terrycojones/tickery/remove-api-806704
Merge into: lp:tickery
Diff against target: 182 lines (+2/-139)
4 files modified
.bzrignore (+1/-0)
tickery/api.py (+0/-131)
tickery/www/about.py (+1/-5)
twisted/plugins/tickery_service.py (+0/-3)
To merge this branch: bzr merge lp:~terrycojones/tickery/remove-api-806704
Reviewer Review Type Date Requested Status
Jamu Kakar Approve
Esteve Fernandez Approve
Review via email: mp+67635@code.launchpad.net

Description of the change

Removes the Tickery API - a very simple change.

To post a comment you must log in.
Revision history for this message
Esteve Fernandez (esteve) wrote :

+1 LGTM. I didn't know Tickery had an API until you told me :-)

review: Approve
Revision history for this message
Jamu Kakar (jkakar) wrote :

Nice one, +1!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2011-06-16 23:49:06 +0000
3+++ .bzrignore 2011-07-11 23:04:44 +0000
4@@ -8,3 +8,4 @@
5 twisted/plugins/dropin.cache
6 pyjamas
7 distribute-*.tar.gz
8+pip-log.txt
9
10=== removed file 'tickery/api.py'
11--- tickery/api.py 2011-06-16 16:10:07 +0000
12+++ tickery/api.py 1970-01-01 00:00:00 +0000
13@@ -1,131 +0,0 @@
14-# Copyright 2010 Fluidinfo Inc.
15-#
16-# Licensed under the Apache License, Version 2.0 (the "License"); you
17-# may not use this file except in compliance with the License. You
18-# may obtain a copy of the License at
19-#
20-# http://www.apache.org/licenses/LICENSE-2.0
21-#
22-# Unless required by applicable law or agreed to in writing, software
23-# distributed under the License is distributed on an "AS IS" BASIS,
24-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
25-# implied. See the License for the specific language governing
26-# permissions and limitations under the License.
27-
28-from twisted.python import log
29-from twisted.web import server, resource, error, http
30-
31-
32-def _returnUID(obj, request):
33- uid = str(obj.uuid)
34- request.setHeader('Content-length', str(len(uid)))
35- request.setHeader('Content-type', 'text/plain')
36- request.write(uid)
37- request.finish()
38-
39-
40-def _error(failure, request):
41- if failure.check(error.Error):
42- code = int(failure.value.status)
43- else:
44- code = http.BAD_REQUEST
45- ep = error.ErrorPage(code, 'An error was encountered', str(failure.value))
46- response = ep.render(request)
47- request.setHeader('Content-length', str(len(response)))
48- request.write(response)
49- request.finish()
50-
51-
52-class API(resource.Resource):
53-
54- def __init__(self, cache):
55- resource.Resource.__init__(self)
56- self.cache = cache
57- self.putChild('uids', UIDs(self.cache))
58- self.putChild('screennames', Screennames(self.cache))
59-
60- def getChild(self, what, request):
61- return error.ErrorPage(
62- http.NOT_FOUND, 'Huh?', "I don't know anything about %r." % what)
63-
64-
65-class UIDs(resource.Resource):
66-
67- allowedMethods = ('GET',)
68-
69- def __init__(self, cache):
70- resource.Resource.__init__(self)
71- self.cache = cache
72-
73- def getChild(self, uid, request):
74- if uid == '':
75- return self
76- else:
77- try:
78- uid = int(uid)
79- except ValueError:
80- return error.ErrorPage(
81- http.BAD_REQUEST,
82- 'Malformed UID',
83- 'The value you supplied (%r) could not be converted '
84- 'to an integer.' % uid)
85- else:
86- log.msg('API: request for uid %d.' % uid)
87- return UID(uid, self.cache)
88-
89-
90-class UID(resource.Resource):
91-
92- allowedMethods = ('GET',)
93- isLeaf = True
94-
95- def __init__(self, uid, cache):
96- resource.Resource.__init__(self)
97- self.uid = uid
98- self.cache = cache
99-
100- def render_GET(self, request):
101- d = self.cache.oidUidScreennameCache.objectByUid(
102- self.uid, userNameCache=self.cache.userCache)
103- d.addCallback(_returnUID, request)
104- d.addErrback(_error, request)
105- return server.NOT_DONE_YET
106-
107-
108-class Screennames(resource.Resource):
109-
110- allowedMethods = ('GET',)
111-
112- def __init__(self, cache):
113- resource.Resource.__init__(self)
114- self.cache = cache
115-
116- def getChild(self, screenname, request):
117- if screenname == '':
118- return self
119- else:
120- log.msg('API: request for screenname %r.' % screenname)
121- return Screenname(screenname, self.cache)
122-
123-
124-class Screenname(resource.Resource):
125-
126- allowedMethods = ('GET',)
127- isLeaf = True
128-
129- def __init__(self, screenname, cache):
130- resource.Resource.__init__(self)
131- self.screenname = screenname
132- self.cache = cache
133-
134- def _getObjectId(self, uid, request):
135- d = self.cache.oidUidScreennameCache.objectByUid(
136- uid, screenname=self.screenname)
137- d.addCallback(_returnUID, request)
138- return d
139-
140- def render_GET(self, request):
141- d = self.cache.userCache.uidByScreenname(self.screenname)
142- d.addCallback(self._getObjectId, request)
143- d.addErrback(_error, request)
144- return server.NOT_DONE_YET
145
146=== modified file 'tickery/www/about.py'
147--- tickery/www/about.py 2011-06-16 17:37:48 +0000
148+++ tickery/www/about.py 2011-07-11 23:04:44 +0000
149@@ -113,11 +113,7 @@
150 <p>
151
152 If you'd like to use the Fluidinfo API, please <a
153-href=\"http://fluidinfo.com/accounts/new\">reserve a Fluidinfo username</a>
154-and then <a href=\"mailto:api@fluidinfo.com\">send us mail</a> to get a
155-password. Note that Fluidinfo is still in an early <a
156-href=\"http://blogs.fluidinfo.com/fluidinfo/2009/08/17/\
157-a-private-alpha-launch/\">private alpha</a> phase.
158+href=\"http://fluidinfo.com/accounts/new\">sign up</a>.
159
160 </p>
161
162
163=== modified file 'twisted/plugins/tickery_service.py'
164--- twisted/plugins/tickery_service.py 2011-06-22 00:09:29 +0000
165+++ twisted/plugins/tickery_service.py 2011-07-11 23:04:44 +0000
166@@ -23,7 +23,6 @@
167 from tickery.www import defaults
168 from tickery.endpoint import twitterEndpoint
169 from tickery.cache import TickeryCache
170-from tickery.api import API
171 from tickery.service import RegularService, AdminService
172 from tickery.options import EndpointOptions
173 from tickery import callback
174@@ -69,8 +68,6 @@
175 adminRoot.putChild('tickery', AdminService(cache))
176 root.putChild('admin', adminRoot)
177
178- root.putChild('api', API(cache))
179-
180 factory = server.Site(root)
181 if options['promiscuous']:
182 kw = {}

Subscribers

People subscribed via source and target branches

to all changes: