Changeset 7734 for main/waeup.sirp/trunk/src/waeup/sirp/utils
- Timestamp:
- 29 Feb 2012, 22:20:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/utils/utils.py
r7722 r7734 21 21 import grok 22 22 import string 23 from zope.i18n import translate 23 24 from random import SystemRandom as r 24 25 from waeup.sirp.interfaces import ISIRPUtils 26 from waeup.sirp.interfaces import MessageFactory as _ 25 27 from waeup.sirp.smtp import send_mail as send_mail_internally 26 28 … … 115 117 """ 116 118 config = grok.getSite()['configuration'] 117 text = """Fullname: %s118 User Id: %s119 User Type: %s120 Portal: %s119 text = _(u"""Fullname: ${a} 120 User Id: ${b} 121 User Type: ${c} 122 Portal: ${d} 121 123 122 %s 123 """ 124 body = text % (from_name,from_username,usertype,portal,body) 124 ${e} 125 """) 126 text = _(text, 127 mapping = { 128 'a':from_name, 129 'b':from_username, 130 'c':usertype, 131 'd':portal, 132 'e':body}) 133 body = translate(text, 'waeup.sirp', 134 target_language=self.PORTAL_LANGUAGE) 125 135 return send_mail( 126 136 from_name,from_addr,rcpt_name,rcpt_addr,subject,body,config) … … 152 162 """ 153 163 subject = 'Your SIRP credentials' 154 text = """Dear %s,164 text = _(u"""Dear ${a}, 155 165 156 %s 166 ${b} 157 167 Student Registration and Information Portal of 158 %s.168 ${c}. 159 169 160 Your user name: %s161 Your password: %s162 Login page: %s170 Your user name: ${d} 171 Your password: ${e} 172 Login page: ${f} 163 173 164 174 Please remember your user name and keep … … 168 178 169 179 Regards 170 """ 180 """) 171 181 config = grok.getSite()['configuration'] 172 182 from_name = config.name_admin … … 174 184 rcpt_name = user.title 175 185 rcpt_addr = user.email 176 body = text % ( 177 rcpt_name, msg,config.name,user.name,password,login_url) 186 text = _(text, 187 mapping = { 188 'a':rcpt_name, 189 'b':msg, 190 'c':config.name, 191 'd':user.name, 192 'e':password, 193 'f':login_url}) 194 195 body = translate(text, 'waeup.sirp', 196 target_language=self.PORTAL_LANGUAGE) 178 197 return send_mail( 179 198 from_name,from_addr,rcpt_name,rcpt_addr,subject,body,config)
Note: See TracChangeset for help on using the changeset viewer.