def write(self, file_or_filename, prog=None, format='xdot'):
        """ Writes the case data in Graphviz DOT language.

        The format 'raw' is used to dump the Dot representation of the Case
        object, without further processing. The output can be processed by any
        of graphviz tools, defined in 'prog'.
        """
        if prog is None:
            file = super(DotWriter, self).write(file_or_filename)
        else:
            buf = StringIO.StringIO()
            super(DotWriter, self).write(buf)
            buf.seek(0)
            data = self.create(buf.getvalue(), prog, format)

            if isinstance(file_or_filename, basestring):
                file = None
                try:
                    file = open(file_or_filename, "wb")
                except:
                    logger.error("Error opening %s." % file_or_filename)
                finally:
                    if file is not None:
                        file.write(data)
                        file.close()
            else:
                file = file_or_filename
                file.write(data)

        return file
def write ( self , file_or_filename , prog = None , format = 'xdot' ) : if prog is None : file = super ( DotWriter , self ) . write ( file_or_filename ) else : buf = StringIO . StringIO ( ) super ( DotWriter , self ) . write ( buf ) buf . seek ( 0 ) data = self . create ( buf . getvalue ( ) , prog , format ) if isinstance ( file_or_filename , basestring ) : file = None try : file = open ( file_or_filename , "wb" ) except : logger . error ( "Error opening %s." % file_or_filename ) finally : if file is not None : file . write ( data ) file . close ( ) else : file = file_or_filename file . write ( data ) return file
Writes the case data in Graphviz DOT language.

        The format 'raw' is used to dump the Dot representation of the Case
        object, without further processing. The output can be processed by any
        of graphviz tools, defined in 'prog'.