Return-Path: Delivered-To: apmail-gump-commits-archive@www.apache.org Received: (qmail 47551 invoked from network); 24 Jun 2005 17:43:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Jun 2005 17:43:15 -0000 Received: (qmail 58868 invoked by uid 500); 24 Jun 2005 17:43:15 -0000 Mailing-List: contact commits-help@gump.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@gump.apache.org Delivered-To: mailing list commits@gump.apache.org Received: (qmail 58849 invoked by uid 99); 24 Jun 2005 17:43:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2005 10:43:14 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 24 Jun 2005 10:43:15 -0700 Received: (qmail 47548 invoked by uid 65534); 24 Jun 2005 17:43:11 -0000 Message-ID: <20050624174311.47547.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r201655 - /gump/trunk/python/gump/actor/document/xdocs/documenter.py Date: Fri, 24 Jun 2005 17:43:11 -0000 To: commits@gump.apache.org From: ajack@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ajack Date: Fri Jun 24 10:43:09 2005 New Revision: 201655 URL: http://svn.apache.org/viewcvs?rev=201655&view=rev Log: Don't fail simply listing files/directories. Modified: gump/trunk/python/gump/actor/document/xdocs/documenter.py Modified: gump/trunk/python/gump/actor/document/xdocs/documenter.py URL: http://svn.apache.org/viewcvs/gump/trunk/python/gump/actor/document/xdocs/documenter.py?rev=201655&r1=201654&r2=201655&view=diff ============================================================================== --- gump/trunk/python/gump/actor/document/xdocs/documenter.py (original) +++ gump/trunk/python/gump/actor/document/xdocs/documenter.py Fri Jun 24 10:43:09 2005 @@ -2565,77 +2565,80 @@ fileList.createEntry("Owner (Referencer): ")) if fileReference.exists(): - if fileReference.isDirectory(): + try: + if fileReference.isDirectory(): - listingSection=fdocument.createSection('Directory Contents') - listingTable=listingSection.createTable(['Filename','Type','Size']) + listingSection=fdocument.createSection('Directory Contents') + listingTable=listingSection.createTable(['Filename','Type','Size']) - directory=fileReference.getPath() + directory=fileReference.getPath() - # Change to os.walk once we can move to Python 2.3 - files=os.listdir(directory) - files.sort() - for listedFile in files: + # Change to os.walk once we can move to Python 2.3 + files=os.listdir(directory) + files.sort() + for listedFile in files: - filePath=os.path.abspath(os.path.join(directory,listedFile)) - listingRow=listingTable.createRow() + filePath=os.path.abspath(os.path.join(directory,listedFile)) + listingRow=listingTable.createRow() - # - listingRow.createData(listedFile) + # + listingRow.createData(listedFile) - if os.path.isdir(filePath): - listingRow.createData('Directory') - listingRow.createData('N/A') - else: - listingRow.createData('File') - listingRow.createData(str(os.path.getsize(filePath))) - else: + if os.path.isdir(filePath): + listingRow.createData('Directory') + listingRow.createData('N/A') + else: + listingRow.createData('File') + listingRow.createData(str(os.path.getsize(filePath))) + else: - # - # Show the content... - # - outputSection=fdocument.createSection('File Contents') - output=fileReference.getPath() - if output: - try: - if os.path.getsize(output) > 100000: - # - # This is *big* just copy/point to it - # - from shutil import copyfile - # Extract name, to make relative to group - outputBaseName=os.path.basename(output) - (outputName,outputExtn)=os.path.splitext(outputBaseName) - displayedOutput=self.resolver.getFile(fileReference, outputName, outputExtn, 1) + # + # Show the content... + # + outputSection=fdocument.createSection('File Contents') + output=fileReference.getPath() + if output: + try: + if os.path.getsize(output) > 100000: + # + # This is *big* just copy/point to it + # + from shutil import copyfile + # Extract name, to make relative to group + outputBaseName=os.path.basename(output) + (outputName,outputExtn)=os.path.splitext(outputBaseName) + displayedOutput=self.resolver.getFile(fileReference, outputName, outputExtn, 1) - # Do the transfer.. - copyfile(output,displayedOutput) - outputSection.createParagraph().createLink(outputBaseName,'Complete File') - else: - outputSource=outputSection.createSource() - o=None - try: - # Keep a length count to not exceed 32K - size=0 - o=open(output, 'r') - line=o.readline() - while line: - length = len(line) - size += length - # Crude to 'ensure' that escaped - # it doesn't exceed 32K. - if size > 20000: - outputSection.createParagraph('Continuation...') - outputSource=outputSection.createSource() - size = length - outputSource.createText(line) + # Do the transfer.. + copyfile(output,displayedOutput) + outputSection.createParagraph().createLink(outputBaseName,'Complete File') + else: + outputSource=outputSection.createSource() + o=None + try: + # Keep a length count to not exceed 32K + size=0 + o=open(output, 'r') line=o.readline() - finally: - if o: o.close() - except Exception, details: - outputSection.createParagraph('Failed to copy contents from :' + output + ' : ' + str(details)) - else: - outputSection.createParagraph('No contents in this file.') + while line: + length = len(line) + size += length + # Crude to 'ensure' that escaped + # it doesn't exceed 32K. + if size > 20000: + outputSection.createParagraph('Continuation...') + outputSource=outputSection.createSource() + size = length + outputSource.createText(line) + line=o.readline() + finally: + if o: o.close() + except Exception, details: + outputSection.createParagraph('Failed to copy contents from :' + output + ' : ' + str(details)) + else: + outputSection.createParagraph('No contents in this file.') + except Exception, details: + fdocument.createWarning('Failed documeting file or directory. %s' % details) else: fdocument.createWarning('No such file or directory.')