ajack 2004/04/21 12:01:52
Modified: python/gump/model project.py
python/gump/test drawing.py
python/gump/output nag.py
python/gump/document/forrest documenter.py
Log:
Listing those affected in a notification mail.
Revision Changes Path
1.76 +20 -5 gump/python/gump/model/project.py
Index: project.py
===================================================================
RCS file: /home/cvs/gump/python/gump/model/project.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- project.py 13 Apr 2004 15:59:24 -0000 1.75
+++ project.py 21 Apr 2004 19:01:52 -0000 1.76
@@ -154,7 +154,7 @@
self.license=None
- self.affected=0
+ self.affectedProjects=[]
#############################################################
#
@@ -213,6 +213,14 @@
def getDescription(self):
return str(self.xml.description) or self.getModule().getDescription()
+ def getLimitedDescription(self, limit=60):
+ desc=str(self.xml.description) or self.getModule().getDescription()
+ if len(desc) > limit:
+ desc=desc[:limit]
+ desc+='...'
+
+ return desc
+
def getMetadataLocation(self):
if self.xml.href and str(self.xml.href): return self.xml.href
return self.getModule().getMetadataLocation()
@@ -277,8 +285,16 @@
return self.getModule().getStats().getLastUpdated()
def determineAffected(self):
- if self.affected: return self.affected
+ if self.affectedProjects: return len(self.affectedProjects)
+ self.gatherAffected()
+ return len(self.affectedProjects)
+
+ def determineAffectedProjects(self):
+ if self.affectedProjects: return self.affectedProjects
+ self.gatherAffected()
+ return self.affectedProjects
+ def gatherAffected(self):
# Look through all dependees
for project in self.getFullDependeeProjectList():
cause=project.getCause()
@@ -286,9 +302,8 @@
if cause:
# The something was this project
if cause == self:
- self.affected += 1
-
- return self.affected
+ if not project in self.affectedProjects:
+ self.affectedProjects.append[project]
def propagateErrorStateChange(self,state,reason,cause,message):
1.4 +2 -2 gump/python/gump/test/drawing.py
Index: drawing.py
===================================================================
RCS file: /home/cvs/gump/python/gump/test/drawing.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- drawing.py 20 Apr 2004 17:44:32 -0000 1.3
+++ drawing.py 21 Apr 2004 19:01:52 -0000 1.4
@@ -27,7 +27,7 @@
UnitTestSuite.__init__(self)
def testDrawingContext(self):
- context=StandardDrawingContext(rect=Rect(0,0,100,100))
+ context=StandardDrawingContext('Test', rect=Rect(0,0,100,100))
def testScaledDrawingContext(self):
context=ScaledDrawingContext('TestScale',None,Rect(0,0,100,100),200,200)
@@ -50,7 +50,7 @@
self.assertEqual('Shifted & Scaled', 125, y)
def testGridDrawingContext(self):
- baseContext=StandardDrawingContext(rect=Rect(0,0,100,200))
+ baseContext=StandardDrawingContext('Test',rect=Rect(0,0,100,200))
context=GridDrawingContext('TestGrid',baseContext,10,10)
for row in [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]:
for col in [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]:
1.33 +19 -0 gump/python/gump/output/nag.py
Index: nag.py
===================================================================
RCS file: /home/cvs/gump/python/gump/output/nag.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- nag.py 16 Apr 2004 17:28:39 -0000 1.32
+++ nag.py 21 Apr 2004 19:01:52 -0000 1.33
@@ -362,6 +362,25 @@
content += ', and has been outstanding for ' + `duration` + ' runs'
content += '. '
+
+ if isinstance(object,Project) and affected:
+ affectedProjects=object.determineAffectedProjects()
+ if 1 or ((duration and duration > 3) and affectedProjects):
+ #
+ # Show those negatively affected
+ #
+ content += 'The following are affected:\n'
+
+ for project in affectedProjects:
+ content += ' - ' + project.getName()
+
+ if project.hasDescription():
+ content += ' '
+ content += project.getLimitedDescription()
+
+ content += '\n'
+
+ content += '\n'
content += self.getGenericContent(object,feedPrefix)
1.9 +22 -2 gump/python/gump/document/forrest/documenter.py
Index: documenter.py
===================================================================
RCS file: /home/cvs/gump/python/gump/document/forrest/documenter.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- documenter.py 20 Apr 2004 23:37:56 -0000 1.8
+++ documenter.py 21 Apr 2004 19:01:52 -0000 1.9
@@ -44,6 +44,7 @@
from gump.model.module import Module
from gump.model.project import Project
+from gump.output.nag import Nagger
from gump.output.statsdb import StatisticsGuru
from gump.output.xref import XRefGuru
from gump.core.gumprun import *
@@ -1497,8 +1498,13 @@
for nagEntry in project.xml.nag:
toaddr=getattr(nagEntry,'to') or workspace.mailinglist
fromaddr=getStringFromUnicode(getattr(nagEntry,'from') or
workspace.email)
- detailsList.createEntry('Nag To:
').createFork('mailto:'+toaddr,toaddr)
- detailsList.createEntry('Nag From:
').createFork('mailto:'+fromaddr,fromaddr)
+ detailsList.createEntry('Notify To:
').createFork('mailto:'+toaddr,toaddr)
+ detailsList.createEntry('Notify From:
').createFork('mailto:'+fromaddr,fromaddr)
+
+
+ detailsList.createEntry('Notify E-mail').createLink(
+ gumpSafeName(project.getName()) + '_notify.html',
+ 'Contents')
elif not project.isPackaged() and project.hasBuildCommand():
document.createWarning('This project does not utilize Gump nagging.')
@@ -1653,6 +1659,20 @@
log.error('Failed to diagram dependencies for [' +
project.getName() + ']', exc_info=1)
document.serialize()
+
+ if project.xml.nag:
+ document=XDocDocument('Project Details : ' + project.getName(), \
+ self.resolver.getFile(project, \
+ project.getName() + '_notify', \
+ '.xml'))
+
+ nagSection=document.createSection('Notification')
+ nagSection.createParagraph('This is the notification mail that is to be
sent')
+ nagger=Nagger(run)
+ content=nagger.getNamedTypedContent(project)
+ nagSection.createSource(content)
+
+ document.serialize()
# Document the project XML
# x=startXDoc(getProjectXMLDocument(workspace,modulename,project.name))
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]