Added module renderers json tsv csv xml
This commit is contained in:
parent
f8cdfff640
commit
ec48c3b5df
|
@ -44,15 +44,15 @@ def render_csv( model, list ):
|
|||
csv( *[ obj[col] for col in _cols] )
|
||||
|
||||
def render_json( model, list ):
|
||||
json( list )
|
||||
json( list.read )
|
||||
|
||||
#def render_json( model, obj ):
|
||||
def render( opts, model, list ): # +format=json,xml,csv +json +tsv
|
||||
if ( 'json' in opts and opts['json'] ) or ( 'format' in opts and 'json' in opts['format'] ):
|
||||
render_json( model, list )
|
||||
if ( 'tsv' in opts and opts['tsv'] ) or ( 'format' in opts and 'tsv' in opts['format'] ):
|
||||
elif ( 'tsv' in opts and opts['tsv'] ) or ( 'format' in opts and 'tsv' in opts['format'] ):
|
||||
render_tsv( model, list )
|
||||
if ( 'csv' in opts and opts['csv'] ) or ( 'format' in opts and 'csv' in opts['format'] ):
|
||||
elif ( 'csv' in opts and opts['csv'] ) or ( 'format' in opts and 'csv' in opts['format'] ):
|
||||
render_csv( model, list )
|
||||
# if ( 'xml' in opts and opts['xml'] ) or ( 'format' in opts and 'xml' in opts['format'] ):
|
||||
# elif ( 'xml' in opts and opts['xml'] ) or ( 'format' in opts and 'xml' in opts['format'] ):
|
||||
# render_xml( model, list )
|
||||
|
|
Loading…
Reference in New Issue