summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2014-02-24 09:49:30 -0800
committerJeff Forcier <jeff@bitprophet.org>2014-02-24 09:49:30 -0800
commitc23579526b4a3c05e6d20bf92074ea0c8c37751d (patch)
tree4c1e44ea6f7da6dcc0ceb16c447ddb9f7ba88a65
parent9ae62eb47a4f7a20eae90a7296ce0a8ecb4923b9 (diff)
Tweak order of System doc page
-rw-r--r--paramiko/server.py84
-rw-r--r--sites/docs/api/server.rst1
2 files changed, 43 insertions, 42 deletions
diff --git a/paramiko/server.py b/paramiko/server.py
index 9ff7243b..e7d37849 100644
--- a/paramiko/server.py
+++ b/paramiko/server.py
@@ -25,48 +25,6 @@ from paramiko.common import *
from paramiko import util
-class InteractiveQuery (object):
- """
- A query (set of prompts) for a user during interactive authentication.
- """
-
- def __init__(self, name='', instructions='', *prompts):
- """
- Create a new interactive query to send to the client. The name and
- instructions are optional, but are generally displayed to the end
- user. A list of prompts may be included, or they may be added via
- the `add_prompt` method.
-
- :param name: name of this query
- :type name: str
- :param instructions: user instructions (usually short) about this query
- :type instructions: str
- :param prompts: one or more authentication prompts
- :type prompts: str
- """
- self.name = name
- self.instructions = instructions
- self.prompts = []
- for x in prompts:
- if (type(x) is str) or (type(x) is unicode):
- self.add_prompt(x)
- else:
- self.add_prompt(x[0], x[1])
-
- def add_prompt(self, prompt, echo=True):
- """
- Add a prompt to this query. The prompt should be a (reasonably short)
- string. Multiple prompts can be added to the same query.
-
- :param prompt: the user prompt
- :type prompt: str
- :param echo: ``True`` (default) if the user's response should be echoed;
- ``False`` if not (for a password or similar)
- :type echo: bool
- """
- self.prompts.append((prompt, echo))
-
-
class ServerInterface (object):
"""
This class defines an interface for controlling the behavior of paramiko
@@ -551,6 +509,48 @@ class ServerInterface (object):
return OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
+class InteractiveQuery (object):
+ """
+ A query (set of prompts) for a user during interactive authentication.
+ """
+
+ def __init__(self, name='', instructions='', *prompts):
+ """
+ Create a new interactive query to send to the client. The name and
+ instructions are optional, but are generally displayed to the end
+ user. A list of prompts may be included, or they may be added via
+ the `add_prompt` method.
+
+ :param name: name of this query
+ :type name: str
+ :param instructions: user instructions (usually short) about this query
+ :type instructions: str
+ :param prompts: one or more authentication prompts
+ :type prompts: str
+ """
+ self.name = name
+ self.instructions = instructions
+ self.prompts = []
+ for x in prompts:
+ if (type(x) is str) or (type(x) is unicode):
+ self.add_prompt(x)
+ else:
+ self.add_prompt(x[0], x[1])
+
+ def add_prompt(self, prompt, echo=True):
+ """
+ Add a prompt to this query. The prompt should be a (reasonably short)
+ string. Multiple prompts can be added to the same query.
+
+ :param prompt: the user prompt
+ :type prompt: str
+ :param echo: ``True`` (default) if the user's response should be echoed;
+ ``False`` if not (for a password or similar)
+ :type echo: bool
+ """
+ self.prompts.append((prompt, echo))
+
+
class SubsystemHandler (threading.Thread):
"""
Handler for a subsytem in server mode. If you create a subclass of this
diff --git a/sites/docs/api/server.rst b/sites/docs/api/server.rst
index 7519ae99..ea854544 100644
--- a/sites/docs/api/server.rst
+++ b/sites/docs/api/server.rst
@@ -2,3 +2,4 @@ Server implementation
=====================
.. automodule:: paramiko.server
+ :member-order: bysource