mixcoatl/utils.py
def print_format(data, payload_format):
    """Format the public instance variables of list of objects into either json, xml or csv . The contents of `__dict__`
    including those instance variables that are name mangled using __

    :param data: a list object to be formatted
    :param str payload_format: the the format that should be returned, either "json","xml","csv"
    :returns str: formatted string
    """


    newdata = []
    for i in data:
        thedict = {}
        for key, value in i.__dict__.iteritems():
            if '__' not in key:
                thedict[key] = value
        newdata.append(thedict)

    if payload_format == "xml":
        return "%s %s %s"% ('<?xml version="1.0" ?><root>',
                            xmltodict.unparse({"item":newdata}, full_document=False),
                            '</root>')
    elif payload_format == "csv":
        return to_csv(newdata)
    else:
        return json.dumps(newdata, indent=4, sort_keys=True)
Format the public instance variables of list of objects into either json, xml or csv . The contents of `__dict__`
    including those instance variables that are name mangled using __

    :param data: a list object to be formatted
    :param str payload_format: the the format that should be returned, either "json","xml","csv"
    :returns str: formatted string
    
Format the public instance variables of list of objects into either json, xml or csv . The contents of `__dict__`
including those instance variables that are name mangled using
Format the public instance variables of list of objects into either json xml or csv . The contents of ` __dict__ ` including those instance variables that are name mangled using
def print_format(data, payload_format):
    newdata = []
    for i in data:
        thedict = {}
        for key, value in i.__dict__.iteritems():
            if '__' not in key:
                thedict[key] = value
        newdata.append(thedict)
    if payload_format == "xml":
        return "%s %s %s"% ('<?xml version="1.0" ?><root>',
                            xmltodict.unparse({"item":newdata}, full_document=False),
                            '</root>')
    elif payload_format == "csv":
        return to_csv(newdata)
    else:
        return json.dumps(newdata, indent=4, sort_keys=True)
def print_format ( data , payload_format ) : newdata = [ ] for i in data : thedict = { } for key , value in i . __dict__ . iteritems ( ) : if '__' not in key : thedict [ key ] = value newdata . append ( thedict ) if payload_format == "xml" : return "%s %s %s" % ( '<?xml version="1.0" ?><root>' , xmltodict . unparse ( { "item" : newdata } , full_document = False ) , '</root>' ) elif payload_format == "csv" : return to_csv ( newdata ) else : return json . dumps ( newdata , indent = 4 , sort_keys = True )
Format the public instance variables of list of objects into either json, xml or csv .
Format the public instance variables of list of objects into either json xml or csv .
"""Format the public instance variables of list of objects into either json, xml or csv . The contents of `__dict__`
    including those instance variables that are name mangled using __

    :param data: a list object to be formatted
    :param str payload_format: the the format that should be returned, either "json","xml","csv"
    :returns str: formatted string
    """
None
str
data
a list object to be formatted
a list object to be formatted
payload_format
the the format that should be returned, either "json","xml","csv"
the the format that should be returned either " json " " xml " " csv "