Fix doco nit from qzrrbz@github
This commit is contained in:
+9
-3
@@ -327,7 +327,9 @@ class Base(object):
|
||||
# to pass bytes to @link #header the header callback @endlink instead,
|
||||
# or trap utf-8 conversion exception, etc.
|
||||
def envfrom_bytes(self,*b):
|
||||
s = (v.decode(encoding='utf-8',errors='surrogateescape') for v in b)
|
||||
try:
|
||||
s = (v.decode(encoding='utf-8') for v in b)
|
||||
except UnicodeDecodeError: s = b
|
||||
return self.envfrom(fld,*s)
|
||||
## Called when the SMTP client says MAIL FROM. Called by the
|
||||
# <a href="milter_api/xxfi_envfrom.html">
|
||||
@@ -346,7 +348,9 @@ class Base(object):
|
||||
# to pass bytes to @link #header the header callback @endlink instead,
|
||||
# or trap utf-8 conversion exception, etc.
|
||||
def envrcpt_bytes(self,*b):
|
||||
s = (v.decode(encoding='utf-8',errors='surrogateescape') for v in b)
|
||||
try:
|
||||
s = (v.decode(encoding='utf-8') for v in b)
|
||||
except UnicodeDecodeError: s = b
|
||||
return self.envrcpt(fld,*s)
|
||||
## Called when the SMTP client says RCPT TO. Called by the
|
||||
# <a href="milter_api/xxfi_envrcpt.html">
|
||||
@@ -372,7 +376,9 @@ class Base(object):
|
||||
# Converts from utf-8 to unicode with surrogate escape. Can be overriden
|
||||
# to pass bytes to @link #header the header callback @endlink instead.
|
||||
def header_bytes(self,fld,val):
|
||||
s = val.decode(encoding='utf-8',errors='surrogateescape')
|
||||
try:
|
||||
s = val.decode(encoding='utf-8')
|
||||
except UnicodeDecodeError: s = val
|
||||
return self.header(fld,s)
|
||||
## Called for each header field in the message body.
|
||||
# @param field name decoded as ascii
|
||||
|
||||
+1
-1
@@ -234,7 +234,7 @@ class TestCtx(object):
|
||||
else:
|
||||
v = val.encode(encoding='ascii',errors='surrogateescape')
|
||||
# invoke the Milter header_callback
|
||||
return Milter.header_callback(self,fld,v)
|
||||
return self._priv.header_bytes(fld,v)
|
||||
|
||||
def _eoh(self):
|
||||
if self._protocol & Milter.P_NOEOH:
|
||||
|
||||
Reference in New Issue
Block a user