public inbox for [email protected]
help / color / mirror / Atom feedFrom: Célestin Matte <[email protected]>
To: [email protected]
Subject: Re: [PATCH] pgweb: Add ARCHIVES_FRONT_ADDRESS to allow configuration of archives
Date: Wed, 27 Oct 2021 11:45:04 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CABUevEwD_qbzgJdZCrFvrfLDM+QVwKW+1RWSkB-xh97Oi+UZ7g@mail.gmail.com>
References: <[email protected]>
<CABUevEwD_qbzgJdZCrFvrfLDM+QVwKW+1RWSkB-xh97Oi+UZ7g@mail.gmail.com>
> This patch adds a new parameter ARCHIVES_FRONT_ADDRESS, which is then never used. Instead it passes in ARCHIVES_SEARCH_SERVER into the templates.
>
> I'm pretty sure that's not intentional? They should both b ARCHIVES_FRONT_ADDRESS?
Oops, indeed, this is the product of a failed git merge --squash.
Fixed patch attached.
--
Célestin Matte
Attachments:
[text/x-patch] 0001-Add-ARCHIVES_FRONT_ADDRESS-to-allow-configuration-of.patch (3.7K, 2-0001-Add-ARCHIVES_FRONT_ADDRESS-to-allow-configuration-of.patch)
download | inline diff:
From 237ab289165e34b77a20e1d1c152cc935892118e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <[email protected]>
Date: Wed, 27 Oct 2021 11:41:45 +0200
Subject: [PATCH] Add ARCHIVES_FRONT_ADDRESS to allow configuration of archives
messages URL
Domain of messages in pgweb's search is currently hardcoded as postgresql.org
in templates/search/listsearch.html. This patch allows to use another domain
for links to messages in archives in the search function.
Since pgarchives' domain can differ from pgweb's one, a new variable is defined
for that purpose instead of using SITE_ROOT.
---
pgweb/search/views.py | 2 ++
pgweb/settings.py | 1 +
templates/search/listsearch.html | 4 ++--
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/pgweb/search/views.py b/pgweb/search/views.py
index 56733c82..9c0bc6ac 100644
--- a/pgweb/search/views.py
+++ b/pgweb/search/views.py
@@ -133,6 +133,7 @@ def search(request):
'listid': listid,
'dates': dateoptions,
'dateval': dateval,
+ 'archives_root': settings.ARCHIVES_FRONT_ADDRESS,
})
else:
return render(request, 'search/sitesearch.html', {
@@ -236,6 +237,7 @@ def search(request):
'firsthit': firsthit,
'lasthit': min(totalhits, firsthit + hitsperpage - 1),
'query': request.GET['q'],
+ 'archives_root': settings.ARCHIVES_FRONT_ADDRESS,
'pagelinks': " ".join(
generate_pagelinks(pagenum,
(totalhits - 1) // hitsperpage + 1,
diff --git a/pgweb/settings.py b/pgweb/settings.py
index 6c1cb24e..5df7e395 100644
--- a/pgweb/settings.py
+++ b/pgweb/settings.py
@@ -164,6 +164,7 @@ VARNISH_PURGERS = () # Extra servers that
DO_ESI = False # Generate ESI tags
ARCHIVES_SEARCH_SERVER = "archives.postgresql.org" # Where to post REST request for archives search
ARCHIVES_SEARCH_PLAINTEXT = False # Contact ARCHIVES_SEARCH_SERVER with http instead of https
+ARCHIVES_FRONT_ADDRESS = "www.postgresql.org" # Domain to read archives messages
FRONTEND_SMTP_RELAY = "magus.postgresql.org" # Where to relay user generated email
OAUTH = {} # OAuth providers and keys
PGDG_ORG_ID = -1 # id of the PGDG organisation entry
diff --git a/templates/search/listsearch.html b/templates/search/listsearch.html
index 4d07ded3..42adcdb8 100644
--- a/templates/search/listsearch.html
+++ b/templates/search/listsearch.html
@@ -53,10 +53,10 @@
<h2>Results {{firsthit}}-{{lasthit}} of {%if hitcount == 1000%}more than 1000{%else%}{{hitcount}}{%endif%}.</h2>
{%if pagelinks %}Result pages: {{pagelinks|safe}}<br/><br/>{%endif%}
{%for hit in hits %}
- {{forloop.counter0|add:firsthit}}. <a href="https://www.postgresql.org/message-id/{{hit.messageid}}">{{hit.subject}}</a> [{{hit.rank|floatformat:2}}]<br/>
+ {{forloop.counter0|add:firsthit}}. <a href="https://{{ archives_root }}/message-id/{{hit.messageid}}">{{hit.subject}}</a> [{{hit.rank|floatformat:2}}]<br/>
From {{hit.author}} on {{hit.date}}.<br/>
{{hit.abstract|safe}}<br/>
- <a href="https://www.postgresql.org/message-id/{{hit.messageid}}">https://www.postgresql.org/message-id/{{hit.messageid}}</a><br/>
+ <a href="https://{{ archives_root }}/message-id/{{hit.messageid}}">https://{{ archives_root }}/message-id/{{hit.messageid}}</a><br/>
<br/>
{%endfor%}
{%if pagelinks %}Result pages: {{pagelinks|safe}}<br/><br/>{%endif%}
--
2.33.1
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [PATCH] pgweb: Add ARCHIVES_FRONT_ADDRESS to allow configuration of archives
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox