source: WAeUP_SRP/base/skins/waeup_student/mail2student.py @ 2293

Last change on this file since 2293 was 2293, checked in by joachim, 17 years ago

better string formatting please test

File size: 1.5 KB
RevLine 
[891]1## Script (Python) "mail2student"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
[1595]7##parameters=co_name=None,co_email=None,student_email=None,probtype=None,commt=None, action=None
[891]8##title=
9##
10# $Id: mail2admin.py 869 2006-11-15 13:46:49Z henrik $
11
[1598]12from urllib import urlencode
13
[891]14mhost = context.MailHost
15prop = context.portal_properties
16
17# the message format, %s will be filled in from data
18
19message = """
20From: %s <%s>
21To: %s
22Cc: %s
23Reply-To: %s
24Subject: %s
25%s
26"""
27
28#prop.email_from_address should be used for To:
[909]29REQUEST = context.REQUEST
[1595]30
31#url_tuple = REQUEST.HTTP_REFERER.split('?')
32#if len(url_tuple) == 2:
33#    url_tuple[1] ='portal_status_message=Your message has been sent!'
34#else:
35#    url_tuple.append('portal_status_message=Your message has been sent!')
36#redirect_url = "?".join(url_tuple)
37#REQUEST.set('rurl', redirect_url) # to see the result in the error log
38
[891]39msg = message % (
40     co_name,
41     co_email,
[1575]42     student_email,
[891]43     co_email,
44     co_email,
45     probtype,
46     commt,
47     )
48mhost.send(msg)
49
50
[1595]51#REQUEST = context.REQUEST
52#RESPONSE = REQUEST.RESPONSE
53#RESPONSE.redirect(redirect_url)
54
55args = {}
56psm = "Your message has been sent!"
57args['portal_status_message'] = psm
[1608]58if action:
59    url = context.absolute_url() + '/' + action + '?' + urlencode(args)
60else:
61    url = context.absolute_url() +'?' + urlencode(args)
[1595]62return REQUEST.RESPONSE.redirect(url)
63
Note: See TracBrowser for help on using the repository browser.