Compare commits

..

No commits in common. "e4e9df88d7e10d5321efe199cf3ae757692c54c2" and "75f617806793c7a3fe750cdb526fae522c604398" have entirely different histories.

3 changed files with 23 additions and 32 deletions

30
main.py
View file

@ -50,29 +50,14 @@ def exception_handler(e: werkzeug.exceptions.InternalServerError) -> tuple[str,
@app.route("/")
def start() -> str:
"""Start form."""
enwp = flask.request.args.get("enwp")
if not enwp:
return flask.render_template("combined.html")
enwp = enwp.strip()
if not enwp:
wikipedia_url = flask.request.args.get("wikipedia")
if not wikipedia_url:
return flask.render_template("combined.html")
input_is = "url" if enwp.startswith(enwiki) else "title"
start = wikipedia_url.find(enwiki) + len(enwiki)
wiki_part2 = unquote(wikipedia_url[start:])
wikipedia_url: str
wiki_part1: str
wiki_part2: str
if input_is == "url":
start = enwp.find(enwiki) + len(enwiki)
wiki_part2 = unquote(enwp[start:])
name = wiki_part2
wiki_part1 = enwp[:start]
wikipedia_url = enwp
else:
name = enwp
wiki_part1 = enwiki
wiki_part2 = name.replace(" ", "_")
wikipedia_url = wiki_part1 + wiki_part2
if "_(" in name:
name = name[: name.find("_(")]
@ -83,9 +68,11 @@ def start() -> str:
return flask.render_template(
"combined.html",
name=name,
enwp=enwp,
wikipedia_url=wikipedia_url,
)
wiki_part1 = wikipedia_url[:start]
if "/in/" in flickr_url:
flickr_url = flickr_url[: flickr_url.find("/in/")]
@ -103,7 +90,6 @@ def start() -> str:
msg = flask.render_template(
"message.jinja",
flickr_url=flickr_url,
enwp=enwp,
wikipedia_url=wikipedia_url,
name=name,
wiki_part1=wiki_part1,
@ -117,7 +103,7 @@ def start() -> str:
return flask.render_template(
"combined.html",
name=name,
enwp=enwp,
wikipedia_url=wikipedia_url,
flickr_url=flickr_url,
subject=subject,
lines=lines,

View file

@ -8,8 +8,8 @@
<h1>Flickr mail</h1>
<form action="{{ url_for(request.endpoint) }}">
<div class="mb-3">
<label for="enwp" class="form-label">Wikipedia article URL or title:</label>
<input type="text" class="form-control" id="enwp" name="enwp" value="{{ enwp }}" required>
<label for="wikipedia" class="form-label">Wikipedia URL:</label>
<input type="text" class="form-control" id="wikipedia" name="wikipedia" value="{{ wikipedia_url }}" required>
</div>
<input type="submit" value="Submit">
@ -21,7 +21,7 @@
<p><a href="https://flickr.com/search/?view_all=1&safe_search=3&text={{ '"' + name + '"' | urlencode }}" target="_blank">Search flickr</a></p>
<form action="{{ url_for(request.endpoint) }}">
<input type="hidden" name="enwp" value="{{ enwp }}"></input>
<input type="hidden" name="wikipedia" value="{{ wikipedia_url }}"></input>
<div class="mb-3">
<label for="flickr" class="form-label">Flickr URL:</label>
<input type="text" class="form-control" id="flickr" name="flickr" value="{{ flickr_url }}" required>

View file

@ -2,19 +2,24 @@
#}
Hi,
I'd like to use your photo to illustrate the article about {{ name }} on Wikipedia.
I wanted to get in touch regarding your photo of {{ name }}, which I came across on Flickr:
{{ flickr_url }}
I am currently working on enhancing the Wikipedia article about {{ name }}, and I believe your image would be a valuable addition to the article. However, to use it on Wikipedia, we need to ensure that it's available under the Creative Commons Attribution (CC BY) license or the Attribution-ShareAlike (CC BY-SA) license. These licenses allow us to use the image with proper attribution.
{{ wiki_part1 }}{{ wiki_part2 | urlencode }}
Would you be willing to change the license of the photo to Creative Commons Attribution so it can be used on Wikipedia? I'll include a credit on the image page.
Just to be clear on the license, it needs to be Attribution or Attribution-ShareAlike. If you select a license with a "NonCommercial" or "NoDerivs" restriction then the images can't be used on Wikipedia.
If you're open to it, could you please consider changing the license of this photo to either CC BY or CC BY-SA? We would, of course, provide full credit on the image page, acknowledging your contribution.
To adjust the license settings, you can click on 'All rights reserved' on the right-hand side of the photo's page, just underneath the date.
Thanks,
Your generosity in allowing us to use this image would greatly enhance the quality of the Wikipedia article and contribute to the dissemination of knowledge about {{ name }}.
Thank you for your consideration, and if you have any questions or require further information, please don't hesitate to contact me.
Warm regards,
Edward
edward@4angle.com