def save(sol, name_or_file, encoding=pyamf.AMF0):
    """
    Writes a L{SOL} object to C{name_or_file}.

    @param name_or_file: Name of file or file-object to write to.
    @param encoding: AMF encoding type.
    """
    f = name_or_file
    opened = False

    if isinstance(name_or_file, basestring):
        f = open(name_or_file, 'wb+')
        opened = True
    elif not hasattr(f, 'write'):
        raise ValueError('Writable stream expected')

    f.write(encode(sol.name, sol, encoding=encoding).getvalue())

    if opened:
        f.close()
def save ( sol , name_or_file , encoding = pyamf . AMF0 ) : f = name_or_file opened = False if isinstance ( name_or_file , basestring ) : f = open ( name_or_file , 'wb+' ) opened = True elif not hasattr ( f , 'write' ) : raise ValueError ( 'Writable stream expected' ) f . write ( encode ( sol . name , sol , encoding = encoding ) . getvalue ( ) ) if opened : f . close ( )
Writes a L{SOL} object to C{name_or_file}.

    @param name_or_file: Name of file or file-object to write to.
    @param encoding: AMF encoding type.