Skip to content

Commit 5249272

Browse files
committed
fix a lambda function and also start with #169
1 parent 36b7600 commit 5249272

6 files changed

Lines changed: 16 additions & 9 deletions

File tree

.claude/temp.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# OPTIMAP
2+
3+
4+
5+
# geoextent
6+

publications/admin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ def export_permalinks_csv(self, request, queryset):
169169
if len(rows) == 1:
170170
self.message_user(request, "No items with DOI in selection.", level=messages.WARNING)
171171
return
172-
esc = lambda v: f"\"{(v or '').replace('\"','\"\"')}\""
173-
csv = "\n".join(",".join(map(esc, r)) for r in rows)
172+
#esc = lambda v: f"\"{(v or '').replace('\"','\"\"')}\""
173+
escape_row = lambda v: '"{}"'.format((v or '').replace('"', '""'))
174+
csv = "\n".join(",".join(map(escape_row, r)) for r in rows)
174175
resp = HttpResponse(csv, content_type="text/csv; charset=utf-8")
175176
resp["Content-Disposition"] = 'attachment; filename="publication_permalinks.csv"'
176177
return resp
File renamed without changes.
File renamed without changes.

publications/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
2525
path('api/schema/ui/', SpectacularRedocView.as_view(url_name='optimap:schema'), name='redoc'),
2626
path('download/geojson/', views.download_geojson, name='download_geojson'),
27-
path("articles/links/", views.article_links_list, name="article-links-list"),
28-
path("article/<path:doi>/", views.article_landing, name="article-landing"),
27+
path("works/", views.works_list, name="works-list"),
28+
path("work/<path:doi>/", views.work_landing, name="article-landing"),
2929
path('download/geopackage/', views.download_geopackage, name='download_geopackage'),
3030
path('favicon.ico', lambda request: redirect('static/favicon.ico', permanent=True)),
3131
path('feed/', RedirectView.as_view(pattern_name='optimap:georss_feed', permanent=True)),

publications/views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,9 @@ def _normalize_authors(pub):
608608
return None
609609

610610

611-
def article_links_list(request):
611+
def works_list(request):
612612
"""
613-
Public page that lists a link for every publication:
613+
Public page that lists a link for every work:
614614
- DOI present -> /article/<doi> (site-local landing page)
615615
- no DOI -> fall back to Publication.url (external/original)
616616
"""
@@ -621,10 +621,10 @@ def article_links_list(request):
621621
links.append({"title": pub.title, "href": reverse("optimap:article-landing", args=[pub.doi])})
622622
elif pub.url:
623623
links.append({"title": pub.title, "href": pub.url})
624-
return render(request, "article_links_list.html", {"links": links})
624+
return render(request, "works.html", {"links": links})
625625

626626

627-
def article_landing(request, doi):
627+
def work_landing(request, doi):
628628
"""
629629
Landing page for a publication with a DOI.
630630
Embeds a small Leaflet map when geometry is available.
@@ -646,4 +646,4 @@ def article_landing(request, doi):
646646
"timeperiod_label": _format_timeperiod(pub),
647647
"authors_list": _normalize_authors(pub),
648648
}
649-
return render(request, "article_landing.html", context)
649+
return render(request, "work_landing_page.html", context)

0 commit comments

Comments
 (0)