Commits

Jesper Nøhr  committed b225c7b

getting the blogserver up and running with the latest code

  • Participants
  • Parent commits 747dfcd

Comments (0)

Files changed (1)

File examples/blogserver/api/handlers.py

 
 from blogserver.blog.models import Blogpost
 
-class AnonymousBlogpostHandler(AnonymousBaseHandler):
-    """
-    Anonymous entrypoint for blogposts.
-    """
-    model = Blogpost
-    fields = ('id', 'title', 'content', 'created_on')
-
-    @classmethod
-    def resource_uri(cls):
-        return ('blogposts', [ 'format', ])
-
 class BlogpostHandler(BaseHandler):
     """
     Authenticated entrypoint for blogposts.
     """
     model = Blogpost
-    anonymous = AnonymousBlogpostHandler
+    anonymous = 'AnonymousBlogpostHandler'
     fields = ('title', 'content', ('author', ('username',)), 
               'created_on', 'content_length')
 
         return len(blogpost.content)
 
     @classmethod
-    def resource_uri(cls):
-        return ('blogposts', [ 'format', ])
+    def resource_uri(cls, blogpost):
+        return ('blogposts', [ 'json', ])
 
     def read(self, request, title=None):
         """
         else:
             return base.all()
 
-    @require_extended
     def create(self, request):
         """
         Creates a new blogpost.
             post.save()
             
             return post
+
+class AnonymousBlogpostHandler(BlogpostHandler, AnonymousBaseHandler):
+    """
+    Anonymous entrypoint for blogposts.
+    """
+    fields = ('id', 'title', 'content', 'created_on')