def format(self): l = 80 obj = self.getattrOnly(constants.OBJECT_KEY) result = '\n#' + '='*(l-2) + '\n' result += '# %s\n' % obj result += '#' + '='*(l-2) + '\n\n' for key, value in self.iteritems(): if value is not None: result += '#' + '-'*(l-2) + '\n' result += '# %s\n' % key result += '#' + '-'*(l-2) + '\n' result += io.formatDictItems(value, '{key:20} : {value!s}\n' ) #end if #end for return result
def formatItems(self, fmt='{key:20} : {value!s}\n'): return io.formatDictItems(self, fmt)
def pfd( object ): print io.formatDictItems( object )