Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a0b44b5a
Kaydet (Commit)
a0b44b5a
authored
Ara 02, 2010
tarafından
R. David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#8989: add 'domain' keyword to make_msgid.
Patch by Adrian von Bidder.
üst
52173d49
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
6 deletions
+23
-6
email.util.rst
Doc/library/email.util.rst
+8
-2
test_email.py
Lib/email/test/test_email.py
+4
-0
utils.py
Lib/email/utils.py
+7
-4
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/email.util.rst
Dosyayı görüntüle @
a0b44b5a
...
@@ -105,11 +105,17 @@ There are several useful utilities provided in the :mod:`email.utils` module:
...
@@ -105,11 +105,17 @@ There are several useful utilities provided in the :mod:`email.utils` module:
``False``. The default is ``False``.
``False``. The default is ``False``.
.. function:: make_msgid(idstring=None)
.. function:: make_msgid(idstring=None
, domain=None
)
Returns a string suitable for an :rfc:`2822`\ -compliant
Returns a string suitable for an :rfc:`2822`\ -compliant
:mailheader:`Message-ID` header. Optional *idstring* if given, is a string
:mailheader:`Message-ID` header. Optional *idstring* if given, is a string
used to strengthen the uniqueness of the message id.
used to strengthen the uniqueness of the message id. Optional *domain* if
given provides the portion of the msgid after the '@'. The default is the
local hostname. It is not normally necessary to override this default, but
may be useful certain cases, such as a constructing distributed system that
uses a consistent domain name across multiple hosts.
.. versionchanged:: 3.2 domain keyword added
.. function:: decode_rfc2231(s)
.. function:: decode_rfc2231(s)
...
...
Lib/email/test/test_email.py
Dosyayı görüntüle @
a0b44b5a
...
@@ -2457,6 +2457,10 @@ multipart/report
...
@@ -2457,6 +2457,10 @@ multipart/report
text/rfc822-headers
text/rfc822-headers
"""
)
"""
)
def
test_make_msgid_domain
(
self
):
self
.
assertEqual
(
email
.
utils
.
make_msgid
(
domain
=
'testdomain-string'
)[
-
19
:],
'@testdomain-string>'
)
# Test the iterator/generators
# Test the iterator/generators
...
...
Lib/email/utils.py
Dosyayı görüntüle @
a0b44b5a
...
@@ -148,13 +148,15 @@ def formatdate(timeval=None, localtime=False, usegmt=False):
...
@@ -148,13 +148,15 @@ def formatdate(timeval=None, localtime=False, usegmt=False):
def
make_msgid
(
idstring
=
None
):
def
make_msgid
(
idstring
=
None
,
domain
=
None
):
"""Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
"""Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
<20020201195627.33539.96671@nightshade.la.mastaler.com>
<20020201195627.33539.96671@nightshade.la.mastaler.com>
Optional idstring if given is a string used to strengthen the
Optional idstring if given is a string used to strengthen the
uniqueness of the message id.
uniqueness of the message id. Optional domain if given provides the
portion of the message id after the '@'. It defaults to the locally
defined hostname.
"""
"""
timeval
=
time
.
time
()
timeval
=
time
.
time
()
utcdate
=
time
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M
%
S'
,
time
.
gmtime
(
timeval
))
utcdate
=
time
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M
%
S'
,
time
.
gmtime
(
timeval
))
...
@@ -164,8 +166,9 @@ def make_msgid(idstring=None):
...
@@ -164,8 +166,9 @@ def make_msgid(idstring=None):
idstring
=
''
idstring
=
''
else
:
else
:
idstring
=
'.'
+
idstring
idstring
=
'.'
+
idstring
idhost
=
socket
.
getfqdn
()
if
domain
is
None
:
msgid
=
'<
%
s.
%
s.
%
s
%
s@
%
s>'
%
(
utcdate
,
pid
,
randint
,
idstring
,
idhost
)
domain
=
socket
.
getfqdn
()
msgid
=
'<
%
s.
%
s.
%
s
%
s@
%
s>'
%
(
utcdate
,
pid
,
randint
,
idstring
,
domain
)
return
msgid
return
msgid
...
...
Misc/ACKS
Dosyayı görüntüle @
a0b44b5a
...
@@ -77,6 +77,7 @@ Eric Beser
...
@@ -77,6 +77,7 @@ Eric Beser
Steven Bethard
Steven Bethard
Stephen Bevan
Stephen Bevan
Ron Bickers
Ron Bickers
Adrian von Bidder
David Binger
David Binger
Dominic Binks
Dominic Binks
Philippe Biondi
Philippe Biondi
...
...
Misc/NEWS
Dosyayı görüntüle @
a0b44b5a
...
@@ -53,6 +53,9 @@ Core and Builtins
...
@@ -53,6 +53,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #8989: email.utils.make_msgid now has a domain parameter that can
override the domain name used in the generated msgid.
- Issue #9299: Add exist_ok parameter to os.makedirs to suppress the
- Issue #9299: Add exist_ok parameter to os.makedirs to suppress the
'File exists' exception when a target directory already exists with the
'File exists' exception when a target directory already exists with the
specified mode. Patch by Ray Allen.
specified mode. Patch by Ray Allen.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment