ajack 2003/10/15 14:51:07
Modified: python/gump nag.py mailer.py document.py
Log:
A bit more nag formatting/testing.
Revision Changes Path
1.8 +44 -8 jakarta-gump/python/gump/nag.py
Index: nag.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/nag.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- nag.py 15 Oct 2003 21:07:43 -0000 1.7
+++ nag.py 15 Oct 2003 21:51:07 -0000 1.8
@@ -73,6 +73,7 @@
from gump.context import *
from gump.model import *
from gump.mailer import *
+from gump.document import getContextAbsoluteUrl
def nag(workspace,context,moduleFilterList=None,projectFilterList=None):
if STATUS_FAILED==context.status:
@@ -99,7 +100,7 @@
def nagWorkspace(workspace,context):
""" Nag for the workspace """
- content=getContext(context, "Workspace ... \n")
+ content=getContent(workspace, context, "Workspace ... \n")
email=EmailMessage(workspace.prefix+': Gump Workspace Problem ',content)
mail([ workspace.mailinglist ],workspace.email,email,workspace.mailserver)
@@ -111,9 +112,11 @@
# Form the content...
#
content+="----------------------------------------------------\n"
- content+=getContent(mctxt,"Module: " + module.name + "\n")
- content+=getContent(pctxt,"Project: " + project.name + "\n" )
+ content+=getContent(workspace,mctxt,"Module: " + module.name + "\n")
+ content+="\n\n\n"
content+="----------------------------------------------------\n"
+ content+=getContent(workspace,pctxt,"Project: " + project.name + "\n" )
+ content+="\n\n\n"
for nagEntry in project.nag:
#
@@ -124,17 +127,17 @@
fromaddr=getattr(nagEntry,'from',workspace.mailinglist)
# We send to a list, but a list of one is fine..
- toaddrs=[ toaddr ]
+ toaddrs=[ '[EMAIL PROTECTED]' ]
# Fire ...
mail(toaddrs,fromaddr,email,workspace.mailserver)
-def getContent(context,message=''):
+def getContent(workspace,context,message=''):
content=''
# Optional message
if message:
- content=message
+ content=message
#
# Add status (and reason)
@@ -159,5 +162,38 @@
content+="\n\nWork Items:\n"
for workitem in context.worklist:
content+=workitem.overview()+"\n"
-
- return content
\ No newline at end of file
+
+ #
+ # Link them back here...
+ #
+ url=getContextAbsoluteUrl(workspace.logurl,context)
+ content += "URL: " + url + "\n"
+
+ return content
+
+
+if __name__=='__main__':
+
+ # init logging
+ logging.basicConfig()
+
+ #set verbosity to show all messages of severity >= default.logLevel
+ log.setLevel(default.logLevel)
+
+ args = handleArgv(sys.argv,0)
+ ws=args[0]
+ ps=args[1]
+
+ context=GumpContext()
+
+ # get parsed workspace definition
+ from gump import load
+ workspace=load(ws, context)
+
+ nagWorkspace(workspace,context)
+
+ module=Module.list['jakarta-gump']
+ project=Project.list['gump']
+ (mctxt,pctxt)=context.getContextsForProject(project)
+ nagProject(workspace,context,module,mctxt,project,pctxt)
+
1.2 +1 -1 jakarta-gump/python/gump/mailer.py
Index: mailer.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/mailer.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mailer.py 29 Aug 2003 00:20:22 -0000 1.1
+++ mailer.py 15 Oct 2003 21:51:07 -0000 1.2
@@ -82,7 +82,7 @@
message.subject,
message.text,
default.signature))
-
+
try:
server = smtplib.SMTP(server)
server.set_debuglevel(1)
1.75 +3 -0 jakarta-gump/python/gump/document.py
Index: document.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- document.py 15 Oct 2003 21:07:43 -0000 1.74
+++ document.py 15 Oct 2003 21:51:07 -0000 1.75
@@ -1135,6 +1135,9 @@
if not wdir: wdir=getWorkDir(rootdir,type)
return os.path.join(wdir,wname+'.xml')
+def getContextAbsoluteUrl(root,context):
+ return root+getContextUrl(context,0);
+
def getContextUrl(context,depth=1):
if isinstance(context,GumpContext):
url=getWorkspaceRelativeUrl(depth)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]