Created
May 22, 2012 21:44
-
-
Save samuraisam/2771823 to your computer and use it in GitHub Desktop.
An example of what the entity framework will be like
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 lenny.handler import BaseHandler | |
from lightt.api.db.series import Series | |
class SeriesHandler(BaseHandler): | |
""" | |
Documentation that will be generated for /series | |
""" | |
name = 'series' # urls can be automatically generated | |
version = 1.2 # version is selected via Accept header | |
allowed_methods = ('GET', 'POST') # allowed methods when authenticated | |
anonymous = { | |
'allow_cors': True, # allow CORS when requesting anonymous | |
'allowed_methods': ('GET',) # allowed methods when requesting anonymous | |
} | |
helpers = [Series] # helper classes available to render/retrieve | |
def read(self, request, key): | |
""" | |
Documentation that will be generated for GET /series | |
""" | |
series_obj = self.series_helper.get(request, key) | |
return { | |
'items': [self.series_helper.render(request, series_obj)] | |
} | |
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 lenny.resource import OAuthResource | |
urlpatterns += [OAuthResource('series')] # generates OAuth 1.0a and 2 endpoints as well |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment