Skip to content

Commit fc8106d

Browse files
fstachuratleb
authored andcommitted
web: Unify _link and _url variable suffixes
1 parent 0f0695e commit fc8106d

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

elixir/web.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
from .api import ApiIdentGetterResource
4141
from .query import get_query
4242
from .web_utils import ProjectConverter, IdentConverter, validate_version, validate_project, validate_ident, \
43-
get_elixir_version_string, get_elixir_repo_link, RequestContext, Config
43+
get_elixir_version_string, get_elixir_repo_url, RequestContext, Config
4444

4545
VERSION_CACHE_DURATION_SECONDS = 2 * 60 # 2 minutes
4646
ADD_ISSUE_LINK = "https://github.com/bootlin/elixir/issues/new"
4747
ELIXIR_VERSION_STRING = get_elixir_version_string()
48-
ELIXIR_REPO_LINK = get_elixir_repo_link(ELIXIR_VERSION_STRING)
48+
ELIXIR_REPO_LINK = get_elixir_repo_url(ELIXIR_VERSION_STRING)
4949

5050
DEFAULT_PROJECT = 'linux'
5151

@@ -70,7 +70,7 @@ def generate_error_details(req, resp, title, details):
7070
f"Error title: {title}\n" + \
7171
f"Error details: {details}\n"
7272

73-
def get_github_issue_link(details: str):
73+
def get_github_issue_url(details: str):
7474
body = ("TODO: add information on how you reached the error here and " +
7575
"validate the details below.\n\n" +
7676
"---\n\n" +
@@ -90,10 +90,10 @@ def get_project_error_page(req, resp, exception: ElixirProjectError):
9090
'current_family': 'A',
9191
'source_base_url': '/',
9292
'elixir_version_string': req.context.config.version_string,
93-
'elixir_repo_link': req.context.config.repo_link,
93+
'elixir_repo_url': req.context.config.repo_url,
9494

9595
'referer': req.referer if req.referer != req.uri else None,
96-
'bug_report_link': get_github_issue_link(report_error_details),
96+
'bug_report_url': get_github_issue_url(report_error_details),
9797
'home_page_url': '/',
9898
'report_error_details': report_error_details,
9999

@@ -157,7 +157,7 @@ def get_error_page(req, resp, exception: ElixirProjectError):
157157
'source_base_url': '/',
158158

159159
'referer': req.referer,
160-
'bug_report_link': ADD_ISSUE_LINK + parse.quote(report_error_details),
160+
'bug_report_url': ADD_ISSUE_LINK + parse.quote(report_error_details),
161161
'report_error_details': report_error_details,
162162

163163
'error_title': exception.title,
@@ -458,7 +458,7 @@ def get_layout_template_context(q: Query, ctx: RequestContext, get_url_with_new_
458458
'current_version_path': current_version_path,
459459
'topbar_families': TOPBAR_FAMILIES,
460460
'elixir_version_string': ctx.config.version_string,
461-
'elixir_repo_link': ctx.config.repo_link,
461+
'elixir_repo_url': ctx.config.repo_url,
462462

463463
'source_base_url': get_source_base_url(project, version),
464464
'ident_base_url': get_ident_base_url(project, version),
@@ -602,10 +602,10 @@ def generate_source_page(ctx: RequestContext, q: Query,
602602
# Generate breadcrumbs
603603
path_split = path.split('/')[1:]
604604
path_temp = ''
605-
breadcrumb_links = []
605+
breadcrumb_urls = []
606606
for p in path_split:
607607
path_temp += '/'+p
608-
breadcrumb_links.append((p, f'{ source_base_url }{ path_temp }'))
608+
breadcrumb_urls.append((p, f'{ source_base_url }{ path_temp }'))
609609

610610
if type == 'tree':
611611
back_path = os.path.dirname(path[:-1])
@@ -627,7 +627,7 @@ def generate_source_page(ctx: RequestContext, q: Query,
627627
raise ElixirProjectError('File not found', 'This file does not exist.',
628628
status=falcon.HTTP_NOT_FOUND,
629629
query=q, project=project, version=version,
630-
extra_template_args={'breadcrumb_links': breadcrumb_links})
630+
extra_template_args={'breadcrumb_urls': breadcrumb_urls})
631631

632632
# Create titles like this:
633633
# root path: "Linux source code (v5.5.6) - Bootlin"
@@ -648,7 +648,7 @@ def generate_source_page(ctx: RequestContext, q: Query,
648648

649649
'title_path': title_path,
650650
'path': path,
651-
'breadcrumb_links': breadcrumb_links,
651+
'breadcrumb_urls': breadcrumb_urls,
652652

653653
**template_ctx,
654654
}

elixir/web_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def get_elixir_version_string():
3333

3434
return ''
3535

36-
def get_elixir_repo_link(version):
36+
def get_elixir_repo_url(version):
3737
if re.match('^[0-9a-f]{5,12}$', version) or version.startswith('v'):
3838
return ELIXIR_REPO_LINK + f'tree/{ version }'
3939
else:
@@ -43,7 +43,7 @@ def get_elixir_repo_link(version):
4343
class Config(NamedTuple):
4444
project_dir: str
4545
version_string: str
46-
repo_link: str
46+
repo_url: str
4747

4848
# Basic information about handled request - current Elixir configuration, configured Jinja environment
4949
# and logger

templates/error.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ <h2>{{ error_title }}</h2>
1616
{% if referer is not none -%}
1717
<li><a class="link" href="{{ referer }}">Go back</a></li>
1818
{%- endif %}
19-
<li><a class="link" href="{{ home_page_link }}">Go to home page</a></li>
20-
{% if bug_report_link is not none -%}
21-
<li><a class="link" href="{{ bug_report_link }}">Report a bug</a></li>
19+
<li><a class="link" href="{{ home_page_url }}">Go to home page</a></li>
20+
{% if bug_report_url is not none -%}
21+
<li><a class="link" href="{{ bug_report_url }}">Report a bug</a></li>
2222
{%- endif %}
2323
</ul>
2424
{% if report_error_details is not none -%}

templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
Top
7070
</a>
7171
<span class="poweredby">powered by
72-
<a target="_blank" href="{{ elixir_repo_link }}">
72+
<a target="_blank" href="{{ elixir_repo_url }}">
7373
Elixir {{ elixir_version_string }}
7474
</a>
7575
</span>

templates/topbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="breadcrumb">
33
<a href="#menu" class="open-menu icon-menu screenreader" title="Open Menu">Open Menu</a>
44
<a class="project" href="{{ source_base_url }}">/</a>
5-
{% for name, url in breadcrumb_links %}
5+
{% for name, url in breadcrumb_urls %}
66
<a href="{{ url }}">{{ name }}</a>
77
{{ '/' if not loop.last else '' }}
88
{% endfor %}

0 commit comments

Comments
 (0)