[Kimchi-devel] [PATCH] pep8 cleanup for auth.py
Aline Manera
alinefm at linux.vnet.ibm.com
Fri Dec 20 14:34:26 UTC 2013
From: Aline Manera <alinefm at br.ibm.com>
This patch cleans up pep8 style issue in auth.py
Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
Makefile.am | 1 +
src/kimchi/auth.py | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index e57d3b6..7770ba7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,6 +39,7 @@ EXTRA_DIST = \
# So it will be checked from now on.
PEP8_WHITELIST = \
src/kimchi/asynctask.py \
+ src/kimchi/auth.py \
src/kimchi/config.py.in \
src/kimchi/disks.py \
src/kimchi/server.py \
diff --git a/src/kimchi/auth.py b/src/kimchi/auth.py
index b665f21..f38d3d6 100644
--- a/src/kimchi/auth.py
+++ b/src/kimchi/auth.py
@@ -20,7 +20,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import base64
import cherrypy
@@ -53,9 +53,9 @@ def authenticate(username, password, service="passwd"):
elif qtype == PAM.PAM_PROMPT_ERROR_MSG:
cherrypy.log.error_log.error("PAM authenticate prompt error "
"message: %s" % query)
- resp.append(('', 0));
+ resp.append(('', 0))
elif qtype == PAM.PAM_PROMPT_TEXT_INFO:
- resp.append(('', 0));
+ resp.append(('', 0))
else:
return None
return resp
@@ -72,6 +72,7 @@ def authenticate(username, password, service="passwd"):
return True
+
def from_browser():
# Enable Basic Authentication for REST tools.
# Ajax request sent from jQuery in browser will have "X-Requested-With"
@@ -79,6 +80,7 @@ def from_browser():
requestHeader = cherrypy.request.headers.get("X-Requested-With", None)
return (requestHeader == "XMLHttpRequest")
+
def check_auth_session():
"""
A user is considered authenticated if we have an established session open
@@ -99,7 +101,7 @@ def check_auth_httpba():
"""
REST API users may authenticate with HTTP Basic Auth. This is not allowed
for the UI because web browsers would cache the credentials and make it
- impossible for the user to log out without closing their browser completely.
+ impossible for the user to log out without closing their browser completely
"""
if from_browser() or not template.can_accept('application/json'):
return False
--
1.7.10.4
More information about the Kimchi-devel
mailing list