Code cleanup

remove the redundant e variable
Use already defined constant
move import to top of file

Change-Id: Ibe9d5da9f5c136c69685b1bc523e60bb19d97b65
This commit is contained in:
George Tian 2016-10-11 10:34:31 +08:00
parent 3079ce0b18
commit 35b9f08ea0
2 changed files with 5 additions and 4 deletions

View File

@ -17,6 +17,9 @@
import os
import sys
from keystone.cmd import cli
# If ../../keystone/__init__.py exists, add ../../ to Python search path, so
# that it will override what happens to be installed in
# /usr/(local/)lib/python...
@ -29,8 +32,6 @@ if os.path.exists(os.path.join(possible_topdir,
'__init__.py')):
sys.path.insert(0, possible_topdir)
from keystone.cmd import cli
# entry point.
def main():

View File

@ -580,7 +580,7 @@ def remove_standard_port(url):
# remove the default ports specified in RFC2616 and 2818
o = moves.urllib.parse.urlparse(url)
separator = ':'
(host, separator, port) = o.netloc.partition(':')
(host, separator, port) = o.netloc.partition(separator)
if o.scheme.lower() == 'http' and port == '80':
# NOTE(gyee): _replace() is not a private method. It has
# an underscore prefix to prevent conflict with field names.
@ -626,7 +626,7 @@ def format_url(url, substitutions, silent_keyerror_failures=None):
"occurred during string substitution: %(typeerror)s")
LOG.error(msg, {"url": url, "typeerror": e})
raise exception.MalformedEndpoint(endpoint=url)
except ValueError as e:
except ValueError:
msg = _LE("Malformed endpoint %s - incomplete format "
"(are you missing a type notifier ?)")
LOG.error(msg, url)