allura
修订版 | ca6116cd20bae26533ce7ecb7f79b919904c3fce (tree) |
---|---|
时间 | 2012-05-31 02:25:16 |
作者 | Dave Brondsema <dbrondsema@geek...> |
Commiter | Dave Brondsema |
[#4296] make all noreply hardcoded addresses be unicode
@@ -149,7 +149,7 @@ def _parse_smtp_addr(addr): | ||
149 | 149 | addrs = _parse_message_id(addr) |
150 | 150 | if addrs and addrs[0]: return addrs[0] |
151 | 151 | if '@' in addr: return addr |
152 | - return 'noreply@in.sf.net' | |
152 | + return u'noreply@in.sf.net' | |
153 | 153 | |
154 | 154 | def isvalid(addr): |
155 | 155 | '''return True if addr is a (possibly) valid email address, false |
@@ -217,7 +217,7 @@ class Thread(Artifact): | ||
217 | 217 | link=artifact.url(), |
218 | 218 | _id=artifact.url()+post._id, |
219 | 219 | from_address=str(author._id) if author != User.anonymous() else None, |
220 | - reply_to_address='noreply@in.sf.net', | |
220 | + reply_to_address=u'noreply@in.sf.net', | |
221 | 221 | subject=subject, |
222 | 222 | text=text, |
223 | 223 | in_reply_to=post.parent_id, |
@@ -133,7 +133,7 @@ class Notification(MappedClass): | ||
133 | 133 | _id=artifact.url()+post._id, |
134 | 134 | from_address=str(author._id) if author != User.anonymous() else None, |
135 | 135 | reply_to_address='"%s" <%s>' % ( |
136 | - subject_prefix, getattr(artifact, 'email_address', 'noreply@in.sf.net')), | |
136 | + subject_prefix, getattr(artifact, 'email_address', u'noreply@in.sf.net')), | |
137 | 137 | subject=subject_prefix + subject, |
138 | 138 | text=text, |
139 | 139 | in_reply_to=post.parent_id, |
@@ -144,7 +144,7 @@ class Notification(MappedClass): | ||
144 | 144 | idx['title_s'],c.user.get_pref('display_name'))) |
145 | 145 | reply_to = '"%s" <%s>' % ( |
146 | 146 | idx['title_s'], |
147 | - getattr(artifact, 'email_address', 'noreply@in.sf.net')) | |
147 | + getattr(artifact, 'email_address', u'noreply@in.sf.net')) | |
148 | 148 | d = dict( |
149 | 149 | from_address=reply_to, |
150 | 150 | reply_to_address=reply_to, |
@@ -509,9 +509,9 @@ class Mailbox(MappedClass): | ||
509 | 509 | self.user_id, from_address, subject, ns, reply_to_address) |
510 | 510 | elif self.type == 'digest': |
511 | 511 | Notification.send_digest( |
512 | - self.user_id, 'noreply@in.sf.net', 'Digest Email', | |
512 | + self.user_id, u'noreply@in.sf.net', 'Digest Email', | |
513 | 513 | notifications) |
514 | 514 | elif self.type == 'summary': |
515 | 515 | Notification.send_summary( |
516 | - self.user_id, 'noreply@in.sf.net', 'Digest Email', | |
516 | + self.user_id, u'noreply@in.sf.net', 'Digest Email', | |
517 | 517 | notifications) |
@@ -255,7 +255,7 @@ class Repository(Artifact): | ||
255 | 255 | @property |
256 | 256 | def email_address(self): |
257 | 257 | domain = '.'.join(reversed(self.app.url[1:-1].split('/'))).replace('_', '-') |
258 | - return 'noreply@%s%s' % (domain, config.common_suffix) | |
258 | + return u'noreply@%s%s' % (domain, config.common_suffix) | |
259 | 259 | |
260 | 260 | def index(self): |
261 | 261 | result = Artifact.index(self) |
@@ -64,13 +64,13 @@ def sendmail(fromaddr, destinations, text, reply_to, subject, | ||
64 | 64 | addrs_html = [] |
65 | 65 | addrs_multi = [] |
66 | 66 | if fromaddr is None: |
67 | - fromaddr = 'noreply@in.sf.net' | |
67 | + fromaddr = u'noreply@in.sf.net' | |
68 | 68 | elif '@' not in fromaddr: |
69 | 69 | log.warning('Looking up user with fromaddr %s', fromaddr) |
70 | 70 | user = M.User.query.get(_id=ObjectId(fromaddr)) |
71 | 71 | if not user: |
72 | 72 | log.warning('Cannot find user with ID %s', fromaddr) |
73 | - fromaddr = 'noreply@in.sf.net' | |
73 | + fromaddr = u'noreply@in.sf.net' | |
74 | 74 | else: |
75 | 75 | fromaddr = user.email_address_header() |
76 | 76 | # Divide addresses based on preferred email formats |
@@ -126,13 +126,13 @@ def sendsimplemail( | ||
126 | 126 | in_reply_to=None): |
127 | 127 | from allura import model as M |
128 | 128 | if fromaddr is None: |
129 | - fromaddr = 'noreply@in.sf.net' | |
129 | + fromaddr = u'noreply@in.sf.net' | |
130 | 130 | elif '@' not in fromaddr: |
131 | 131 | log.warning('Looking up user with fromaddr %s', fromaddr) |
132 | 132 | user = M.User.query.get(_id=ObjectId(fromaddr)) |
133 | 133 | if not user: |
134 | 134 | log.warning('Cannot find user with ID %s', fromaddr) |
135 | - fromaddr = 'noreply@in.sf.net' | |
135 | + fromaddr = u'noreply@in.sf.net' | |
136 | 136 | else: |
137 | 137 | fromaddr = user.email_address_header() |
138 | 138 | plain_msg = mail_util.encode_email_part(text, 'plain') |