Repository: aio-libs/aiosmtpd
Pull request #135 (2017-10-19 21:01:31)

Remove the asyncio.coroutine decorator for smtp_HELP because only Python 3.5+

matrixise: from my tox with this branch
```
  py35-cov: commands succeeded
  py35-nocov: commands succeeded
  py35-diffcov: commands succeeded
  py36-cov: commands succeeded
  py36-nocov: commands succeeded
  py36-diffcov: commands succeeded
  qa: commands succeeded
  docs: commands succeeded
  congratulations :)
```

Patch:
diff --git a/aiosmtpd/docs/NEWS.rst b/aiosmtpd/docs/NEWS.rst
index e5357c0..0ddd5a5 100644
--- a/aiosmtpd/docs/NEWS.rst
+++ b/aiosmtpd/docs/NEWS.rst
@@ -5,6 +5,7 @@
 1.2 (201X-XX-XX)
 ================
 * Improve the documentation on enabling ``STARTTLS``.  (Closes #125)
+* Add customizable ident field to SMTP class constructor. (Closes #131)
 
 
 1.1 (2017-07-06)
diff --git a/aiosmtpd/docs/manpage.rst b/aiosmtpd/docs/manpage.rst
index ddf099a..dc223a5 100644
--- a/aiosmtpd/docs/manpage.rst
+++ b/aiosmtpd/docs/manpage.rst
@@ -8,7 +8,7 @@ Provide a Simple Mail Transfer Procotol (SMTP) server
 
 :Author: The aiosmtpd developers
 :Date: 2017-07-01
-:Copyright: 2015-2017 The aiosmtpd developrs
+:Copyright: 2015-2017 The aiosmtpd developers
 :Version: 1.1
 :Manual section: 1
 
diff --git a/aiosmtpd/docs/smtp.rst b/aiosmtpd/docs/smtp.rst
index df0b3c6..529865a 100644
--- a/aiosmtpd/docs/smtp.rst
+++ b/aiosmtpd/docs/smtp.rst
@@ -101,7 +101,7 @@ override to provide additional responses.
 SMTP API
 ========
 
-.. class:: SMTP(handler, *, data_size_limit=33554432, enable_SMTPUTF8=False, decode_data=False, hostname=None, tls_context=None, require_starttls=False, loop=None)
+.. class:: SMTP(handler, *, data_size_limit=33554432, enable_SMTPUTF8=False, decode_data=False, hostname=None, ident=None, tls_context=None, require_starttls=False, loop=None)
 
    *handler* is an instance of a :ref:`handler <handlers>` class.
 
@@ -117,9 +117,13 @@ SMTP API
    the ``DATA`` command, assigning the string value to the :ref:`envelope's
    <sessions_and_envelopes>` ``content`` attribute.  The default is False.
 
-   *hostname* is the string returned in the ``220`` greeting response given to
-   clients when they first connect to the server.  If not given, the system's
-   fully-qualified domain name is used.
+   *hostname* is the first part of the string returned in the ``220`` greeting
+   response given to clients when they first connect to the server.  If not given,
+   the system's fully-qualified domain name is used.
+   
+   *ident* is the second part of the string returned in the ``220`` greeting
+   response that identifies the software name and version of the SMTP server
+   to the client. If not given, a default Python SMTP ident is used.
 
    *tls_context* and *require_starttls*.  The ``STARTTLS`` option of ESMTP
    (and LMTP), defined in `RFC 3207`_, provides for secure connections to the
diff --git a/aiosmtpd/smtp.py b/aiosmtpd/smtp.py
index a2d3827..681732a 100644
--- a/aiosmtpd/smtp.py
+++ b/aiosmtpd/smtp.py
@@ -72,10 +72,11 @@ class SMTP(asyncio.StreamReaderProtocol):
                  enable_SMTPUTF8=False,
                  decode_data=False,
                  hostname=None,
+                 ident=None,
                  tls_context=None,
                  require_starttls=False,
                  loop=None):
-        self.__ident__ = __ident__
+        self.__ident__ = ident or __ident__
         self.loop = loop if loop else make_loop()
         super().__init__(
             asyncio.StreamReader(loop=self.loop),
@@ -422,7 +423,6 @@ class SMTP(asyncio.StreamReaderProtocol):
         return True
 
     @syntax('HELP [command]')
-    @asyncio.coroutine
     async def smtp_HELP(self, arg):
         code = 250
         if arg:


Test patch:
diff --git a/aiosmtpd/tests/test_smtp.py b/aiosmtpd/tests/test_smtp.py
index 8d2a07d..be1da96 100644
--- a/aiosmtpd/tests/test_smtp.py
+++ b/aiosmtpd/tests/test_smtp.py
@@ -68,8 +68,7 @@ class CustomHostnameController(Controller):
 
 class CustomIdentController(Controller):
     def factory(self):
-        server = Server(self.handler)
-        server.__ident__ = 'Identifying SMTP v2112'
+        server = Server(self.handler, ident='Identifying SMTP v2112')
         return server