stephan preeker avatar stephan preeker committed b9dffe9

generated documentation now works for all handlers docs are ordered.

Comments (0)

Files changed (2)

 import inspect, handler
 from piston.handler import typemapper
+from piston.handler import handler_tracker
 from django.core.urlresolvers import get_resolver, get_callable, get_script_prefix
 from django.shortcuts import render_to_response
     docs = [ ]
-    for handler, (model, anonymous) in typemapper.iteritems():
+    for handler in handler_tracker: 
+    def _compare(doc1, doc2): 
+       #handlers and their anonymous counterparts are put next to each other.
+       name1 ="Anonymous", "")
+       name2 ="Anonymous", "")
+       return cmp(name1, name2)    
+    docs.sort(_compare)
     return render_to_response('documentation.html', 
         { 'docs': docs }, RequestContext(request))


 from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
 typemapper = { }
+handler_tracker = [ ]
 class HandlerMetaClass(type):
         if hasattr(new_cls, 'model'):
             typemapper[new_cls] = (new_cls.model, new_cls.is_anonymous)
+        if name not in ('BaseHandler', 'AnonymousBaseHandler'):
+            handler_tracker.append(new_cls)
         return new_cls
 class BaseHandler(object):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.