django_libretto/templatetags/navigation.py
def pathMatches(path, urlName, **kwargs):
	'''
	:param path: str
	:param urlName: str
	:returns: bool.
	'''
	resolved = urlresolvers.resolve(path)

	# Different URL name => the current URL cannot match.
	resolvedName = '{r.namespace}:{r.url_name}'.format(r = resolved) if resolved.namespace else resolved.url_name
	if urlName != resolvedName:
		return False

	# If any of the current keyword args is missing or different, the URL cannot match.
	for key, value in kwargs.items():
		currentArg = resolved.kwargs.get(key)
		if currentArg is None or str(value) != str(currentArg):
			return False

	return True
def pathMatches(path, urlName, **kwargs):
	'''
	:param path: str
	:param urlName: str
	:returns: bool.
	'''
	resolved = urlresolvers.resolve(path)

	# Different URL name => the current URL cannot match.
	resolvedName = '{r.namespace}:{r.url_name}'.format(r = resolved) if resolved.namespace else resolved.url_name
	if urlName != resolvedName:
		return False

	# If any of the current keyword args is missing or different, the URL cannot match.
	for key, value in kwargs.items():
		currentArg = resolved.kwargs.get(key)
		if currentArg is None or str(value) != str(currentArg):
			return False

	return True
def pathMatches ( path , urlName , * * kwargs ) : resolved = urlresolvers . resolve ( path ) # Different URL name => the current URL cannot match. resolvedName = '{r.namespace}:{r.url_name}' . format ( r = resolved ) if resolved . namespace else resolved . url_name if urlName != resolvedName : return False # If any of the current keyword args is missing or different, the URL cannot match. for key , value in kwargs . items ( ) : currentArg = resolved . kwargs . get ( key ) if currentArg is None or str ( value ) != str ( currentArg ) : return False return True
:param path: str
	:param urlName: str
	:returns: bool.
: param path : str : param urlName : str : returns : bool .