From 001435a297da6cdf9a5cceda127ddd674117d207 Mon Sep 17 00:00:00 2001 From: Suyash Vardhan Mathur Date: Fri, 11 Jun 2021 14:15:10 +0530 Subject: [PATCH] refactor: Rename and move app_filters.py. Moved the code in zerver/templatetags/app_filters.py to more intuitive location and name at zerver/lib/templates.py. --- tools/test-backend | 2 +- zerver/lib/send_email.py | 2 +- zerver/{templatetags/app_filters.py => lib/templates.py} | 0 zerver/templatetags/__init__.py | 0 zerver/views/documentation.py | 2 +- zproject/jinja2/__init__.py | 2 +- 6 files changed, 4 insertions(+), 4 deletions(-) rename zerver/{templatetags/app_filters.py => lib/templates.py} (100%) delete mode 100644 zerver/templatetags/__init__.py diff --git a/tools/test-backend b/tools/test-backend index 3c0b8df982..4a281922e5 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -98,7 +98,7 @@ not_yet_fully_covered = [ "zerver/lib/unminify.py", "zerver/lib/utils.py", "zerver/lib/zephyr.py", - "zerver/templatetags/app_filters.py", + "zerver/lib/templates.py", "zerver/templatetags/minified_js.py", # Low priority for coverage "zerver/lib/ccache.py", diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py index 93b1f1c7f4..b4638f4c2f 100644 --- a/zerver/lib/send_email.py +++ b/zerver/lib/send_email.py @@ -482,7 +482,7 @@ def send_custom_email(users: List[UserProfile], options: Dict[str, Any]) -> None with open(plain_text_template_path, "w") as f: f.write(parsed_email_template.get_payload()) - from zerver.templatetags.app_filters import render_markdown_path + from zerver.lib.templates import render_markdown_path rendered_input = render_markdown_path(plain_text_template_path.replace("templates/", "")) diff --git a/zerver/templatetags/app_filters.py b/zerver/lib/templates.py similarity index 100% rename from zerver/templatetags/app_filters.py rename to zerver/lib/templates.py diff --git a/zerver/templatetags/__init__.py b/zerver/templatetags/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/zerver/views/documentation.py b/zerver/views/documentation.py index f06157a98b..05c2303f95 100644 --- a/zerver/views/documentation.py +++ b/zerver/views/documentation.py @@ -14,9 +14,9 @@ from zerver.decorator import add_google_analytics_context from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, HubotIntegration, WebhookIntegration from zerver.lib.request import REQ, has_request_variables from zerver.lib.subdomains import get_subdomain +from zerver.lib.templates import render_markdown_path from zerver.models import Realm from zerver.openapi.openapi import get_endpoint_from_operationid, get_openapi_summary -from zerver.templatetags.app_filters import render_markdown_path def add_api_uri_context(context: Dict[str, Any], request: HttpRequest) -> None: diff --git a/zproject/jinja2/__init__.py b/zproject/jinja2/__init__.py index bd9018b7ed..683335d1c1 100644 --- a/zproject/jinja2/__init__.py +++ b/zproject/jinja2/__init__.py @@ -10,7 +10,7 @@ from jinja2 import Environment from two_factor.templatetags.two_factor import device_action from zerver.context_processors import DEFAULT_PAGE_PARAMS -from zerver.templatetags.app_filters import display_list, render_markdown_path, webpack_entry +from zerver.lib.templates import display_list, render_markdown_path, webpack_entry def json_dumps(obj: object) -> str: