fix shadowed variable
'tag' was being used for both a string value and a boolean value
This commit is contained in:
parent
27e7447569
commit
88a60d05b6
1 changed files with 5 additions and 5 deletions
|
@ -4,7 +4,7 @@ from functools import wraps
|
|||
from uuid import uuid4
|
||||
|
||||
|
||||
def parse_namespace_repository(repository, tag=False):
|
||||
def parse_namespace_repository(repository, include_tag=False):
|
||||
parts = repository.rstrip('/').split('/', 1)
|
||||
if len(parts) < 2:
|
||||
namespace = 'library'
|
||||
|
@ -12,15 +12,15 @@ def parse_namespace_repository(repository, tag=False):
|
|||
else:
|
||||
(namespace, repository) = parts
|
||||
|
||||
if tag:
|
||||
if include_tag:
|
||||
parts = repository.split(':', 1)
|
||||
if len(parts) < 2:
|
||||
tag = None
|
||||
tag = 'latest'
|
||||
else:
|
||||
(repository, tag) = parts
|
||||
|
||||
repository = urllib.quote_plus(repository)
|
||||
if tag:
|
||||
if include_tag:
|
||||
return (namespace, repository, tag)
|
||||
return (namespace, repository)
|
||||
|
||||
|
@ -34,7 +34,7 @@ def parse_repository_name(f):
|
|||
def parse_repository_name_and_tag(f):
|
||||
@wraps(f)
|
||||
def wrapper(repository, *args, **kwargs):
|
||||
(namespace, repository, tag) = parse_namespace_repository(repository, tag=True)
|
||||
namespace, repository, tag = parse_namespace_repository(repository, include_tag=True)
|
||||
return f(namespace, repository, tag, *args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
|
|
Reference in a new issue