Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/utils.py
Show First 20 Lines • Show All 328 Lines • ▼ Show 20 Lines | def gen_link(url, link_text=None, link_attrs=None): | ||||
link = '<a%shref="%s">%s</a>' % (attrs, escape(url), escape(link_text)) | link = '<a%shref="%s">%s</a>' % (attrs, escape(url), escape(link_text)) | ||||
return mark_safe(link) | return mark_safe(link) | ||||
def _snapshot_context_query_params(snapshot_context): | def _snapshot_context_query_params(snapshot_context): | ||||
query_params = None | query_params = None | ||||
if snapshot_context and snapshot_context["origin_info"]: | if snapshot_context and snapshot_context["origin_info"]: | ||||
origin_info = snapshot_context["origin_info"] | origin_info = snapshot_context["origin_info"] | ||||
query_params = {"origin": origin_info["url"]} | query_params = {"origin_url": origin_info["url"]} | ||||
if "timestamp" in snapshot_context["query_params"]: | if "timestamp" in snapshot_context["query_params"]: | ||||
query_params["timestamp"] = snapshot_context["query_params"]["timestamp"] | query_params["timestamp"] = snapshot_context["query_params"]["timestamp"] | ||||
if "visit_id" in snapshot_context["query_params"]: | if "visit_id" in snapshot_context["query_params"]: | ||||
query_params["visit_id"] = snapshot_context["query_params"]["visit_id"] | query_params["visit_id"] = snapshot_context["query_params"]["visit_id"] | ||||
elif snapshot_context: | elif snapshot_context: | ||||
query_params = {"snapshot_id": snapshot_context["snapshot_id"]} | query_params = {"snapshot_id": snapshot_context["snapshot_id"]} | ||||
return query_params | return query_params | ||||
▲ Show 20 Lines • Show All 464 Lines • Show Last 20 Lines |