<s> """<STR_LIT>""" <EOL> from django . views . generic . simple import direct_to_template <EOL> from wapi . function import ApiFunction , ApiNamespace <EOL> from wapi . utils import api_iterate , get_instance <EOL> class ApiDocumentator ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , api , auth_methods = None ) : <EOL> self . auth_methods = get_instance ( auth_methods or [ ] ) <EOL> self . api = get_instance ( api ) <EOL> def __call__ ( self , request ) : <EOL> functions = [ ] <EOL> for func in api_iterate ( self . api ) : <EOL> function = ApiFunction ( func ) <EOL> if function . documented : <EOL> functions . append ( function ) <EOL> functions . sort ( cmp = lambda x , y : cmp ( x . name , y . name ) ) <EOL> if hasattr ( self . api . __class__ , '<STR_LIT>' ) : <EOL> namespaces = [ ] <EOL> for name , nsname in self . api . NAMESPACES : <EOL> namespaces . append ( ApiNamespace ( name , nsname , functions ) ) <EOL> return direct_to_template ( request , '<STR_LIT>' , <EOL> { <EOL> '<STR_LIT>' : functions , <EOL> '<STR_LIT>' : namespaces , <EOL> } <EOL> ) </s>
