Translate the whole site to English: English routes with 301 redirects from the Dutch paths, English UI, docs, seeds and captions, one-time live content migration
This commit is contained in:
@@ -35,6 +35,7 @@ from molodetz.database.posts import (
|
||||
count_published,
|
||||
get_post,
|
||||
get_post_by_slug,
|
||||
get_post_by_slug_tail,
|
||||
insert_post,
|
||||
post_counts_by_author,
|
||||
published_posts,
|
||||
@@ -112,6 +113,7 @@ __all__ = [
|
||||
"get_join_request",
|
||||
"get_post",
|
||||
"get_post_by_slug",
|
||||
"get_post_by_slug_tail",
|
||||
"get_service_state",
|
||||
"get_session",
|
||||
"get_setting",
|
||||
|
||||
@@ -41,7 +41,7 @@ TABLE_EXAMPLES = {
|
||||
"slug": "x",
|
||||
"title": "x",
|
||||
"body": "x",
|
||||
"topic": "rol",
|
||||
"topic": "roll",
|
||||
"status": "draft",
|
||||
"is_placeholder": False,
|
||||
"user_uid": "x",
|
||||
|
||||
@@ -40,6 +40,16 @@ def get_post_by_slug(slug):
|
||||
return resolve_by_slug("posts", slug)
|
||||
|
||||
|
||||
def get_post_by_slug_tail(slug):
|
||||
tail = (slug or "").rsplit("-", 1)[-1]
|
||||
if "posts" not in db.tables or len(tail) != 12 or not all(c in "0123456789abcdef" for c in tail):
|
||||
return None
|
||||
for row in db["posts"].find(deleted_at=None):
|
||||
if row["uid"].replace("-", "").endswith(tail):
|
||||
return row
|
||||
return None
|
||||
|
||||
|
||||
def published_posts(topic=None, before=None, limit=25, user_uid=None):
|
||||
filters = {"status": "published"}
|
||||
if topic:
|
||||
|
||||
Reference in New Issue
Block a user