From ccaeb5240e395fd8fa7ee8407d51f728be595be2 Mon Sep 17 00:00:00 2001 From: Stephane Bortzmeyer Date: Wed, 2 Aug 2023 17:52:44 +0200 Subject: [PATCH] Search of region --- search.py | 5 +++++ search.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/search.py b/search.py index b5f432d..58eb52c 100755 --- a/search.py +++ b/search.py @@ -69,6 +69,9 @@ def application(environ, start_response): elif form["what"] == "script": sql = "SELECT code,added,comments FROM Scripts WHERE code = %s" term = form["string"].capitalize() + elif form["what"] == "region": + sql = "SELECT code,added,comments FROM Regions WHERE code = %s" + term = form["string"].upper() else: status = "400 Invalid request" msg = "Unknown search category \"%s\"\r\n" % form["what"] @@ -96,6 +99,8 @@ def application(environ, start_response): sql = "SELECT Languages.code, Descriptions.description FROM Languages,Descriptions_Languages,Descriptions WHERE Descriptions_Languages.description = Descriptions.id AND Descriptions_Languages.lang = Languages.code AND position(%s in lower(Descriptions.description)) > 0;" elif form["what"] == "script": sql = "SELECT Scripts.code, Descriptions.description FROM Scripts,Descriptions_Scripts,Descriptions WHERE Descriptions_Scripts.description = Descriptions.id AND Descriptions_Scripts.script = Scripts.code AND position(%s in lower(Descriptions.description)) > 0;" + elif form["what"] == "region": + sql = "SELECT Regions.code, Descriptions.description FROM Regions,Descriptions_Regions,Descriptions WHERE Descriptions_Regions.description = Descriptions.id AND Descriptions_Regions.region = Regions.code AND position(%s in lower(Descriptions.description)) > 0;" cursor.execute(sql, (form["string"], )) found = False with tag("h1"): diff --git a/search.xml b/search.xml index f1b1f93..e20471c 100644 --- a/search.xml +++ b/search.xml @@ -6,6 +6,7 @@

Search in: