Commit 2298a7e
committed
fix: authenticate_message: Do not set None to spf_result.smtp_mailfrom
Closes issue #33.
```
self = <test_authentication.TestAuthenticateMessage testMethod=test_authenticate_dmarc_prev_spf>
def test_authenticate_dmarc_prev_spf(self):
prev = "Authentication-Results: example.com; spf=pass smtp.mailfrom=gmail.com"
> res = authenticate_message(self.message2, "example.com", prev=prev, spf=False, dkim=True, dmarc=True, dnsfunc=self.dnsfunc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
authheaders/test/test_authentication.py:155:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
authheaders/__init__.py:434: in authenticate_message
return str(auth_res)
^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/authres/core.py:476: in __str__
return ''.join((self.HEADER_FIELD_NAME, ': ', self.header_value()))
^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/authres/core.py:492: in header_value
strs.append(str(result))
^^^^^^^^^^^
/usr/lib/python3/dist-packages/authres/core.py:222: in __str__
strs.append(str(property_))
^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <authres.core.AuthenticationResultProperty object at 0x7fc4178465f0>
def __str__(self):
if self.comment:
return '%s.%s=%s (%s)' % (self.type, self.name, self.value.quote_if_needed(), self.comment)
else:
> return '%s.%s=%s' % (self.type, self.name, self.value.quote_if_needed())
^^^^^^^^^^^^^^^^^^^^^^^^^^
E AttributeError: 'NoneType' object has no attribute 'quote_if_needed'
/usr/lib/python3/dist-packages/authres/core.py:132: AttributeError
```1 parent 9c62915 commit 2298a7e
2 files changed
Lines changed: 30 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | | - | |
151 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
152 | 172 | | |
153 | 173 | | |
154 | 174 | | |
| |||
0 commit comments