Skip to content

Instantly share code, notes, and snippets.

@samuraisam
Created May 22, 2012 21:44
Show Gist options
  • Save samuraisam/2771823 to your computer and use it in GitHub Desktop.
Save samuraisam/2771823 to your computer and use it in GitHub Desktop.
An example of what the entity framework will be like
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)]
}
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