Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webssh
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑天保
webssh
Commits
f78588bc
Commit
f78588bc
authored
Apr 26, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change self to cls in class methods
parent
fb5bf28d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
handler.py
webssh/handler.py
+7
-7
No files found.
webssh/handler.py
View file @
f78588bc
...
@@ -55,7 +55,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
...
@@ -55,7 +55,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
return
data
.
decode
(
'utf-8'
)
return
data
.
decode
(
'utf-8'
)
@classmethod
@classmethod
def
get_specific_pkey
(
self
,
pkeycls
,
privatekey
,
password
):
def
get_specific_pkey
(
cls
,
pkeycls
,
privatekey
,
password
):
logging
.
info
(
'Trying {}'
.
format
(
pkeycls
.
__name__
))
logging
.
info
(
'Trying {}'
.
format
(
pkeycls
.
__name__
))
try
:
try
:
pkey
=
pkeycls
.
from_private_key
(
io
.
StringIO
(
privatekey
),
pkey
=
pkeycls
.
from_private_key
(
io
.
StringIO
(
privatekey
),
...
@@ -68,14 +68,14 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
...
@@ -68,14 +68,14 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
return
pkey
return
pkey
@classmethod
@classmethod
def
get_pkey_obj
(
self
,
privatekey
,
password
):
def
get_pkey_obj
(
cls
,
privatekey
,
password
):
password
=
password
.
encode
(
'utf-8'
)
if
password
else
None
password
=
password
.
encode
(
'utf-8'
)
if
password
else
None
pkey
=
self
.
get_specific_pkey
(
paramiko
.
RSAKey
,
privatekey
,
password
)
\
pkey
=
cls
.
get_specific_pkey
(
paramiko
.
RSAKey
,
privatekey
,
password
)
\
or
self
.
get_specific_pkey
(
paramiko
.
DSSKey
,
privatekey
,
password
)
\
or
cls
.
get_specific_pkey
(
paramiko
.
DSSKey
,
privatekey
,
password
)
\
or
self
.
get_specific_pkey
(
paramiko
.
ECDSAKey
,
privatekey
,
password
)
\
or
cls
.
get_specific_pkey
(
paramiko
.
ECDSAKey
,
privatekey
,
password
)
\
or
self
.
get_specific_pkey
(
paramiko
.
Ed25519Key
,
privatekey
,
or
cls
.
get_specific_pkey
(
paramiko
.
Ed25519Key
,
privatekey
,
password
)
password
)
if
not
pkey
:
if
not
pkey
:
raise
ValueError
(
'Not a valid private key file or '
raise
ValueError
(
'Not a valid private key file or '
'wrong password for decrypting the private key.'
)
'wrong password for decrypting the private key.'
)
...
...
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