Update of /cvsroot/happydoc/HappyDoc3/happydoclib/docset
In directory sc8-pr-cvs1:/tmp/cvs-serv28698/happydoclib/docset
Modified Files:
base.py
Log Message:
Always create the directory containing an output file before trying to
open the file for writing.
Add a default handler for the application/x-class mimetype.
Pass the PackageTree instance to openOutput() so it can be used to
generate header information.
Index: base.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc3/happydoclib/docset/base.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** base.py 29 Dec 2002 18:35:48 -0000 1.13
--- base.py 1 Jan 2003 14:00:40 -0000 1.14
***************
*** 322,325 ****
--- 322,326 ----
"""Register a writer for the specified mimetype.
"""
+ #print '%s -> %s' % (mimetype, writerName)
self.mimetype_writer_mapping[mimetype] = writerName
return
***************
*** 353,356 ****
--- 354,358 ----
('application/x-directory' , 'processDirectory'),
('text/x-python' , 'processPythonFile'),
+ ('application/x-class' , 'processPythonClass'),
('text/plain' , 'processPlainTextFile'),
('text/x-structured' , 'processPlainTextFile'),
***************
*** 487,491 ****
raise NotImplementedError('writeTOCFile')
! def writeFileHeader(self, output, title='', subtitle=''):
"""Given an open output stream, write a header using the title and subtitle.
--- 489,493 ----
raise NotImplementedError('writeTOCFile')
! def writeFileHeader(self, output, packageTreeNode, title='', subtitle=''):
"""Given an open output stream, write a header using the title and subtitle.
***************
*** 501,505 ****
raise NotImplementedError('writeFileFooter')
! def openOutput(self, name, title='', subtitle=''):
"""Open the output stream from the name.
--- 503,507 ----
raise NotImplementedError('writeFileFooter')
! def openOutput(self, name, packageTreeNode, title='', subtitle=''):
"""Open the output stream from the name.
***************
*** 507,512 ****
subtitle. Returns the stream.
"""
f = open(name, 'wt')
! self.writeFileHeader(f, title=title, subtitle=subtitle)
return f
--- 509,519 ----
subtitle. Returns the stream.
"""
+
+ directory, basename = os.path.split(name)
+ if not os.path.exists(directory):
+ self.rmkdir(directory)
+
f = open(name, 'wt')
! self.writeFileHeader(f, packageTreeNode, title=title, subtitle=subtitle)
return f
***************
*** 609,612 ****
--- 616,620 ----
output_file = self.openOutput(
output_filename,
+ packageTreeNode,
title=self.title,
subtitle=packageTreeNode.getRelativeFilename(),
|