Page MenuHomec4science

Send_Modify_Mail.py.wml
No OneTemporary

File Metadata

Created
Tue, Nov 5, 14:28

Send_Modify_Mail.py.wml

## $Id$
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002, 2003, 2004, 2005 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
## Description: function Send_Modify_Mail
## This function sends an email saying the document has been
## correctly updated
## Author: T.Baron
## PARAMETERS: addressesMBI: email addresses to which the mail is sent
## fieldnameMBI: name of the file containing the modified
## fields
## sourceDoc: name of the type of document
## emailFile: name of the file containing the email of the
## user
execfile("%s/cdsware/websubmit_functions/mail.py" % pylibdir)
def Send_Modify_Mail (parameters,curdir,form):
FROMADDR = '%s Submission Engine <%s>' % (cdsname,supportemail)
global sysno,rn
if parameters['emailFile']!= None and parameters['emailFile']!= "" and os.path.exists("%s/%s" % (curdir,parameters['emailFile'])):
fp = open("%s/%s" % (curdir,parameters['emailFile']),"r")
sub = fp.read()
fp.close()
sub = sub.replace ("\n","")
else:
sub = ""
m_fields = parameters['fieldnameMBI']
type = parameters['sourceDoc']
rn = re.sub("[\n\r ]+","",rn)
if os.path.exists("%s/%s" % (curdir,m_fields)):
fp = open("%s/%s" % (curdir,m_fields),"r")
fields = fp.read()
fp.close()
fields = fields.replace ("\n"," | ")
fields = re.sub("[| \n\r]+$","",fields)
else:
fields = ""
email_txt = "Dear Sir or Madam, \n%s %s has just been modified.\nModified fields: %s\n\n" % (type,rn,fields)
if accessurl != "" and sysno != "":
email_txt += "You can check the modified document here:\n"
email_txt += "<%s?id=%s>\n\n" % (accessurl,sysno)
email_txt += "Please note that the modifications will be taken into account in a couple of minutes.\n\nBest regards,\nThe %s Server support Team" % cdsname
# send the mail
body = forge_email(FROMADDR,sub,parameters['addressesMBI'],"%s modified" % rn,email_txt)
tostring = "%s,%s" % (sub,parameters['addressesMBI'])
tolist = re.split(",",tostring)
send_email(FROMADDR,tolist,body,0)
return ""
</protect>

Event Timeline