mirror of https://github.com/zulip/zulip.git
python: Convert deprecated Django ugettext alias to gettext.
django.utils.translation.ugettext is a deprecated alias of django.utils.translation.gettext as of Django 3.0, and will be removed in Django 4.0. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
173ce9a3fc
commit
e7ed907cf6
|
@ -23,7 +23,7 @@ from django.urls import reverse
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
from django.utils.timesince import timesince
|
from django.utils.timesince import timesince
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from jinja2 import Markup as mark_safe
|
from jinja2 import Markup as mark_safe
|
||||||
from psycopg2.sql import SQL, Composable, Literal
|
from psycopg2.sql import SQL, Composable, Literal
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ from django.conf import settings
|
||||||
from django.core.signing import Signer
|
from django.core.signing import Signer
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
from django.utils.translation import gettext_lazy
|
||||||
from django.utils.translation import override as override_language
|
from django.utils.translation import override as override_language
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from django.utils.translation import ugettext_lazy
|
|
||||||
|
|
||||||
from corporate.models import (
|
from corporate.models import (
|
||||||
Customer,
|
Customer,
|
||||||
|
@ -172,8 +172,8 @@ def get_idempotency_key(ledger_entry: LicenseLedger) -> Optional[str]:
|
||||||
|
|
||||||
class BillingError(Exception):
|
class BillingError(Exception):
|
||||||
# error messages
|
# error messages
|
||||||
CONTACT_SUPPORT = ugettext_lazy("Something went wrong. Please contact {email}.")
|
CONTACT_SUPPORT = gettext_lazy("Something went wrong. Please contact {email}.")
|
||||||
TRY_RELOADING = ugettext_lazy("Something went wrong. Please reload the page.")
|
TRY_RELOADING = gettext_lazy("Something went wrong. Please reload the page.")
|
||||||
|
|
||||||
# description is used only for tests
|
# description is used only for tests
|
||||||
def __init__(self, description: str, message: Optional[str] = None) -> None:
|
def __init__(self, description: str, message: Optional[str] = None) -> None:
|
||||||
|
|
|
@ -10,7 +10,7 @@ from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from corporate.lib.stripe import (
|
from corporate.lib.stripe import (
|
||||||
DEFAULT_INVOICE_DAYS_UNTIL_DUE,
|
DEFAULT_INVOICE_DAYS_UNTIL_DUE,
|
||||||
|
|
|
@ -166,7 +166,7 @@ A string in Python can be marked for translation using the `_()` function,
|
||||||
which can be imported as follows:
|
which can be imported as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
```
|
```
|
||||||
|
|
||||||
Zulip expects all the error messages to be translatable as well. To
|
Zulip expects all the error messages to be translatable as well. To
|
||||||
|
@ -180,13 +180,13 @@ JsonableError(_('English Text'))
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're declaring a user-facing string at top level or in a class, you need to
|
If you're declaring a user-facing string at top level or in a class, you need to
|
||||||
use `ugettext_lazy` instead, to ensure that the translation happens at
|
use `gettext_lazy` instead, to ensure that the translation happens at
|
||||||
request-processing time when Django knows what language to use, e.g.:
|
request-processing time when Django knows what language to use, e.g.:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from zproject.backends import check_password_strength, email_belongs_to_ldap
|
from zproject.backends import check_password_strength, email_belongs_to_ldap
|
||||||
|
|
||||||
AVATAR_CHANGES_DISABLED_ERROR = ugettext_lazy("Avatar changes are disabled in this organization.")
|
AVATAR_CHANGES_DISABLED_ERROR = gettext_lazy("Avatar changes are disabled in this organization.")
|
||||||
|
|
||||||
def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpResponse:
|
def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpResponse:
|
||||||
...
|
...
|
||||||
|
@ -200,7 +200,7 @@ class Realm(models.Model):
|
||||||
...
|
...
|
||||||
...
|
...
|
||||||
|
|
||||||
STREAM_EVENTS_NOTIFICATION_TOPIC = ugettext_lazy('stream events')
|
STREAM_EVENTS_NOTIFICATION_TOPIC = gettext_lazy('stream events')
|
||||||
```
|
```
|
||||||
|
|
||||||
To ensure we always internationalize our JSON errors messages, the
|
To ensure we always internationalize our JSON errors messages, the
|
||||||
|
|
|
@ -84,7 +84,7 @@ The Hello World integration is in `zerver/webhooks/helloworld/view.py`:
|
||||||
from typing import Any, Dict, Iterable, Optional
|
from typing import Any, Dict, Iterable, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
|
|
@ -70,16 +70,16 @@ rules:
|
||||||
- id: translated-format
|
- id: translated-format
|
||||||
languages: [python]
|
languages: [python]
|
||||||
pattern-either:
|
pattern-either:
|
||||||
- pattern: django.utils.translation.ugettext(... .format(...))
|
- pattern: django.utils.translation.gettext(... .format(...))
|
||||||
- pattern: django.utils.translation.ugettext(f"...")
|
- pattern: django.utils.translation.gettext(f"...")
|
||||||
- pattern: django.utils.translation.ugettext_lazy(... .format(...))
|
- pattern: django.utils.translation.gettext_lazy(... .format(...))
|
||||||
- pattern: django.utils.translation.ugettext_lazy(f"...")
|
- pattern: django.utils.translation.gettext_lazy(f"...")
|
||||||
severity: ERROR
|
severity: ERROR
|
||||||
message: "Format strings after translation, not before"
|
message: "Format strings after translation, not before"
|
||||||
|
|
||||||
- id: translated-format-lazy
|
- id: translated-format-lazy
|
||||||
languages: [python]
|
languages: [python]
|
||||||
pattern: django.utils.translation.ugettext_lazy(...).format(...)
|
pattern: django.utils.translation.gettext_lazy(...).format(...)
|
||||||
severity: ERROR
|
severity: ERROR
|
||||||
message: "Immediately formatting a lazily translated string destroys its laziness"
|
message: "Immediately formatting a lazily translated string destroys its laziness"
|
||||||
|
|
||||||
|
@ -123,8 +123,8 @@ rules:
|
||||||
languages: [python]
|
languages: [python]
|
||||||
pattern-either:
|
pattern-either:
|
||||||
- pattern: '"..." % ...'
|
- pattern: '"..." % ...'
|
||||||
- pattern: django.utils.translation.ugettext(...) % ...
|
- pattern: django.utils.translation.gettext(...) % ...
|
||||||
- pattern: django.utils.translation.ugettext_lazy(...) % ...
|
- pattern: django.utils.translation.gettext_lazy(...) % ...
|
||||||
severity: ERROR
|
severity: ERROR
|
||||||
message: "Prefer f-strings or .format for string formatting"
|
message: "Prefer f-strings or .format for string formatting"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ from django.http.multipartparser import MultiPartParser
|
||||||
from django.shortcuts import resolve_url
|
from django.shortcuts import resolve_url
|
||||||
from django.template.response import SimpleTemplateResponse, TemplateResponse
|
from django.template.response import SimpleTemplateResponse, TemplateResponse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django_otp import user_has_device
|
from django_otp import user_has_device
|
||||||
from two_factor.utils import default_device
|
from two_factor.utils import default_device
|
||||||
|
|
|
@ -13,7 +13,7 @@ from django.core.validators import validate_email
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlsafe_base64_encode
|
from django.utils.http import urlsafe_base64_encode
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from jinja2 import Markup as mark_safe
|
from jinja2 import Markup as mark_safe
|
||||||
from two_factor.forms import AuthenticationTokenForm as TwoFactorAuthenticationTokenForm
|
from two_factor.forms import AuthenticationTokenForm as TwoFactorAuthenticationTokenForm
|
||||||
from two_factor.utils import totp_digits
|
from two_factor.utils import totp_digits
|
||||||
|
|
|
@ -33,8 +33,8 @@ from django.db.models import Count, Exists, F, OuterRef, Q, Sum
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import override as override_language
|
from django.utils.translation import override as override_language
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from psycopg2.extras import execute_values
|
from psycopg2.extras import execute_values
|
||||||
from psycopg2.sql import SQL
|
from psycopg2.sql import SQL
|
||||||
from typing_extensions import TypedDict
|
from typing_extensions import TypedDict
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Iterable, List, Optional, Sequence, Union, cast
|
from typing import Iterable, List, Optional, Sequence, Union, cast
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.exceptions import JsonableError
|
from zerver.lib.exceptions import JsonableError
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.request import JsonableError
|
from zerver.lib.request import JsonableError
|
||||||
from zerver.lib.upload import delete_message_image
|
from zerver.lib.upload import delete_message_image
|
||||||
|
|
|
@ -4,7 +4,7 @@ import os
|
||||||
from typing import Any, Callable, Dict, Optional
|
from typing import Any, Callable, Dict, Optional
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
internal_send_huddle_message,
|
internal_send_huddle_message,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
|
||||||
def validate_domain(domain: Optional[str]) -> None:
|
def validate_domain(domain: Optional[str]) -> None:
|
||||||
|
|
|
@ -13,8 +13,8 @@ from bs4 import BeautifulSoup
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import get_backends
|
from django.contrib.auth import get_backends
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import override as override_language
|
from django.utils.translation import override as override_language
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from lxml.cssselect import CSSSelector
|
from lxml.cssselect import CSSSelector
|
||||||
|
|
||||||
from confirmation.models import one_click_unsubscribe_link
|
from confirmation.models import one_click_unsubscribe_link
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Callable, Dict, Optional, Set, Tuple
|
||||||
|
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.name_restrictions import is_disposable_domain
|
from zerver.lib.name_restrictions import is_disposable_domain
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import re
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.exceptions import OrganizationAdministratorRequired
|
from zerver.lib.exceptions import OrganizationAdministratorRequired
|
||||||
from zerver.lib.request import JsonableError
|
from zerver.lib.request import JsonableError
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any, Dict
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.mail import mail_admins
|
from django.core.mail import mail_admins
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.filters import clean_data_from_query_parameters
|
from zerver.filters import clean_data_from_query_parameters
|
||||||
from zerver.lib.actions import internal_send_stream_message
|
from zerver.lib.actions import internal_send_stream_message
|
||||||
|
|
|
@ -4,7 +4,7 @@ import copy
|
||||||
from typing import Any, Callable, Dict, Iterable, Optional, Sequence, Set
|
from typing import Any, Callable, Dict, Iterable, Optional, Sequence, Set
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from version import API_FEATURE_LEVEL, ZULIP_VERSION
|
from version import API_FEATURE_LEVEL, ZULIP_VERSION
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, NoReturn, Optional, Type, TypeVar
|
from typing import Any, Dict, List, NoReturn, Optional, Type, TypeVar
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
T = TypeVar("T", bound="AbstractEnum")
|
T = TypeVar("T", bound="AbstractEnum")
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
This module stores data for "External Account" custom profile field.
|
This module stores data for "External Account" custom profile field.
|
||||||
"""
|
"""
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.types import ProfileFieldData
|
from zerver.lib.types import ProfileFieldData
|
||||||
from zerver.lib.validator import (
|
from zerver.lib.validator import (
|
||||||
|
|
|
@ -4,39 +4,39 @@ from typing import Dict, List
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.functional import Promise
|
from django.utils.functional import Promise
|
||||||
from django.utils.translation import ugettext_lazy
|
from django.utils.translation import gettext_lazy
|
||||||
|
|
||||||
from zerver.models import UserHotspot, UserProfile
|
from zerver.models import UserHotspot, UserProfile
|
||||||
|
|
||||||
INTRO_HOTSPOTS: Dict[str, Dict[str, Promise]] = {
|
INTRO_HOTSPOTS: Dict[str, Dict[str, Promise]] = {
|
||||||
"intro_reply": {
|
"intro_reply": {
|
||||||
"title": ugettext_lazy("Reply to a message"),
|
"title": gettext_lazy("Reply to a message"),
|
||||||
"description": ugettext_lazy("Click anywhere on a message to reply."),
|
"description": gettext_lazy("Click anywhere on a message to reply."),
|
||||||
},
|
},
|
||||||
"intro_streams": {
|
"intro_streams": {
|
||||||
"title": ugettext_lazy("Catch up on a stream"),
|
"title": gettext_lazy("Catch up on a stream"),
|
||||||
"description": ugettext_lazy(
|
"description": gettext_lazy(
|
||||||
"Messages sent to a stream are seen by everyone subscribed "
|
"Messages sent to a stream are seen by everyone subscribed "
|
||||||
"to that stream. Try clicking on one of the stream links below."
|
"to that stream. Try clicking on one of the stream links below."
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"intro_topics": {
|
"intro_topics": {
|
||||||
"title": ugettext_lazy("Topics"),
|
"title": gettext_lazy("Topics"),
|
||||||
"description": ugettext_lazy(
|
"description": gettext_lazy(
|
||||||
"Every message has a topic. Topics keep conversations "
|
"Every message has a topic. Topics keep conversations "
|
||||||
"easy to follow, and make it easy to reply to conversations that start "
|
"easy to follow, and make it easy to reply to conversations that start "
|
||||||
"while you are offline."
|
"while you are offline."
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"intro_gear": {
|
"intro_gear": {
|
||||||
"title": ugettext_lazy("Settings"),
|
"title": gettext_lazy("Settings"),
|
||||||
"description": ugettext_lazy(
|
"description": gettext_lazy(
|
||||||
"Go to Settings to configure your notifications and display settings."
|
"Go to Settings to configure your notifications and display settings."
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"intro_compose": {
|
"intro_compose": {
|
||||||
"title": ugettext_lazy("Compose"),
|
"title": gettext_lazy("Compose"),
|
||||||
"description": ugettext_lazy(
|
"description": gettext_lazy(
|
||||||
"Click here to start a new conversation. Pick a topic "
|
"Click here to start a new conversation. Pick a topic "
|
||||||
"(2-3 words is best), and give it a go!"
|
"(2-3 words is best), and give it a go!"
|
||||||
),
|
),
|
||||||
|
|
|
@ -7,7 +7,7 @@ from django.contrib.staticfiles.storage import staticfiles_storage
|
||||||
from django.urls.resolvers import RegexPattern
|
from django.urls.resolvers import RegexPattern
|
||||||
from django.utils.functional import Promise
|
from django.utils.functional import Promise
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
from django.utils.translation import ugettext as ugettext_lazy
|
from django.utils.translation import gettext as gettext_lazy
|
||||||
|
|
||||||
from zerver.lib.storage import static_path
|
from zerver.lib.storage import static_path
|
||||||
from zerver.lib.types import Validator
|
from zerver.lib.types import Validator
|
||||||
|
@ -32,20 +32,20 @@ features for writing and configuring integrations efficiently.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CATEGORIES: Dict[str, Promise] = {
|
CATEGORIES: Dict[str, Promise] = {
|
||||||
"meta-integration": ugettext_lazy("Integration frameworks"),
|
"meta-integration": gettext_lazy("Integration frameworks"),
|
||||||
"continuous-integration": ugettext_lazy("Continuous integration"),
|
"continuous-integration": gettext_lazy("Continuous integration"),
|
||||||
"customer-support": ugettext_lazy("Customer support"),
|
"customer-support": gettext_lazy("Customer support"),
|
||||||
"deployment": ugettext_lazy("Deployment"),
|
"deployment": gettext_lazy("Deployment"),
|
||||||
"communication": ugettext_lazy("Communication"),
|
"communication": gettext_lazy("Communication"),
|
||||||
"financial": ugettext_lazy("Financial"),
|
"financial": gettext_lazy("Financial"),
|
||||||
"hr": ugettext_lazy("HR"),
|
"hr": gettext_lazy("HR"),
|
||||||
"marketing": ugettext_lazy("Marketing"),
|
"marketing": gettext_lazy("Marketing"),
|
||||||
"misc": ugettext_lazy("Miscellaneous"),
|
"misc": gettext_lazy("Miscellaneous"),
|
||||||
"monitoring": ugettext_lazy("Monitoring tools"),
|
"monitoring": gettext_lazy("Monitoring tools"),
|
||||||
"project-management": ugettext_lazy("Project management"),
|
"project-management": gettext_lazy("Project management"),
|
||||||
"productivity": ugettext_lazy("Productivity"),
|
"productivity": gettext_lazy("Productivity"),
|
||||||
"version-control": ugettext_lazy("Version control"),
|
"version-control": gettext_lazy("Version control"),
|
||||||
"bots": ugettext_lazy("Interactive bots"),
|
"bots": gettext_lazy("Interactive bots"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import orjson
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.db.models import Max, Sum
|
from django.db.models import Max, Sum
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from psycopg2.sql import SQL
|
from psycopg2.sql import SQL
|
||||||
from typing_extensions import TypedDict
|
from typing_extensions import TypedDict
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import os
|
||||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence
|
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.request import JsonableError
|
from zerver.lib.request import JsonableError
|
||||||
from zerver.lib.topic import get_topic_from_message_info
|
from zerver.lib.topic import get_topic_from_message_info
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Dict, List
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
create_users,
|
create_users,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from typing import Any, AnyStr, Dict, Optional
|
from typing import Any, AnyStr, Dict, Optional
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from requests import Response, Session
|
from requests import Response, Session
|
||||||
|
|
||||||
from version import ZULIP_VERSION
|
from version import ZULIP_VERSION
|
||||||
|
|
|
@ -13,7 +13,7 @@ from django.conf import settings
|
||||||
from django.db import IntegrityError, transaction
|
from django.db import IntegrityError, transaction
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import statsd_increment
|
from zerver.decorator import statsd_increment
|
||||||
from zerver.lib.avatar import absolute_avatar_url
|
from zerver.lib.avatar import absolute_avatar_url
|
||||||
|
|
|
@ -6,7 +6,7 @@ import orjson
|
||||||
import requests
|
import requests
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from analytics.models import InstallationCount, RealmCount
|
from analytics.models import InstallationCount, RealmCount
|
||||||
from version import ZULIP_VERSION
|
from version import ZULIP_VERSION
|
||||||
|
|
|
@ -19,7 +19,7 @@ from typing import (
|
||||||
import orjson
|
import orjson
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from zerver.lib.exceptions import ErrorCode, InvalidJSONError, JsonableError
|
from zerver.lib.exceptions import ErrorCode, InvalidJSONError, JsonableError
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, List, Mapping, Optional
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.http import HttpResponse, HttpResponseNotAllowed
|
from django.http import HttpResponse, HttpResponseNotAllowed
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.exceptions import JsonableError
|
from zerver.lib.exceptions import JsonableError
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ from django.db import transaction
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
from django.template.exceptions import TemplateDoesNotExist
|
from django.template.exceptions import TemplateDoesNotExist
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import override as override_language
|
from django.utils.translation import override as override_language
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
|
|
||||||
from confirmation.models import generate_key
|
from confirmation.models import generate_key
|
||||||
from scripts.setup.inline_email_css import inline_template
|
from scripts.setup.inline_email_css import inline_template
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Iterable, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from typing_extensions import TypedDict
|
from typing_extensions import TypedDict
|
||||||
|
|
||||||
from zerver.lib.exceptions import StreamAdministratorRequired
|
from zerver.lib.exceptions import StreamAdministratorRequired
|
||||||
|
|
|
@ -23,7 +23,7 @@ from django.core.files import File
|
||||||
from django.core.signing import BadSignature, TimestampSigner
|
from django.core.signing import BadSignature, TimestampSigner
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from jinja2 import Markup as mark_safe
|
from jinja2 import Markup as mark_safe
|
||||||
from PIL import ExifTags, Image, ImageOps
|
from PIL import ExifTags, Image, ImageOps
|
||||||
from PIL.GifImagePlugin import GifImageFile
|
from PIL.GifImagePlugin import GifImageFile
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.exceptions import JsonableError
|
from zerver.lib.exceptions import JsonableError
|
||||||
from zerver.models import Realm, UserGroup, UserGroupMembership, UserProfile
|
from zerver.models import Realm, UserGroup, UserGroupMembership, UserProfile
|
||||||
|
|
|
@ -7,7 +7,7 @@ from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from zulip_bots.custom_exceptions import ConfigValidationError
|
from zulip_bots.custom_exceptions import ConfigValidationError
|
||||||
|
|
||||||
from zerver.lib.avatar import avatar_url, get_avatar_field
|
from zerver.lib.avatar import avatar_url, get_avatar_field
|
||||||
|
|
|
@ -34,7 +34,7 @@ from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Un
|
||||||
import orjson
|
import orjson
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import URLValidator, validate_email
|
from django.core.validators import URLValidator, validate_email
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.request import JsonableError, ResultT
|
from zerver.lib.request import JsonableError, ResultT
|
||||||
from zerver.lib.types import ProfileFieldData, Validator
|
from zerver.lib.types import ProfileFieldData, Validator
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Callable, Dict, Optional, Union
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
check_send_private_message,
|
check_send_private_message,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.actions import do_set_user_display_setting
|
from zerver.lib.actions import do_set_user_display_setting
|
||||||
from zerver.lib.exceptions import JsonableError
|
from zerver.lib.exceptions import JsonableError
|
||||||
|
|
|
@ -10,8 +10,8 @@ from django.conf import settings
|
||||||
from django.conf.locale import LANG_INFO
|
from django.conf.locale import LANG_INFO
|
||||||
from django.core.management.base import CommandParser
|
from django.core.management.base import CommandParser
|
||||||
from django.core.management.commands import compilemessages
|
from django.core.management.commands import compilemessages
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import override as override_language
|
from django.utils.translation import override as override_language
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from django.utils.translation.trans_real import to_language
|
from django.utils.translation.trans_real import to_language
|
||||||
from pyuca import Collator
|
from pyuca import Collator
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ from django.shortcuts import render
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
from django.utils.cache import patch_vary_headers
|
from django.utils.cache import patch_vary_headers
|
||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.csrf import csrf_failure as html_csrf_failure
|
from django.views.csrf import csrf_failure as html_csrf_failure
|
||||||
from sentry_sdk import capture_exception
|
from sentry_sdk import capture_exception
|
||||||
from sentry_sdk.integrations.logging import ignore_logger
|
from sentry_sdk.integrations.logging import ignore_logger
|
||||||
|
|
|
@ -32,8 +32,8 @@ from django.db.models.query import QuerySet
|
||||||
from django.db.models.signals import post_delete, post_save
|
from django.db.models.signals import post_delete, post_save
|
||||||
from django.utils.functional import Promise
|
from django.utils.functional import Promise
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import ugettext_lazy
|
from django.utils.translation import gettext_lazy
|
||||||
|
|
||||||
from confirmation import settings as confirmation_settings
|
from confirmation import settings as confirmation_settings
|
||||||
from zerver.lib import cache
|
from zerver.lib import cache
|
||||||
|
@ -363,7 +363,7 @@ class Realm(models.Model):
|
||||||
|
|
||||||
DEFAULT_NOTIFICATION_STREAM_NAME = "general"
|
DEFAULT_NOTIFICATION_STREAM_NAME = "general"
|
||||||
INITIAL_PRIVATE_STREAM_NAME = "core team"
|
INITIAL_PRIVATE_STREAM_NAME = "core team"
|
||||||
STREAM_EVENTS_NOTIFICATION_TOPIC = ugettext_lazy("stream events")
|
STREAM_EVENTS_NOTIFICATION_TOPIC = gettext_lazy("stream events")
|
||||||
notifications_stream: Optional["Stream"] = models.ForeignKey(
|
notifications_stream: Optional["Stream"] = models.ForeignKey(
|
||||||
"Stream",
|
"Stream",
|
||||||
related_name="+",
|
related_name="+",
|
||||||
|
@ -397,7 +397,7 @@ class Realm(models.Model):
|
||||||
COMMUNITY = 2
|
COMMUNITY = 2
|
||||||
org_type: int = models.PositiveSmallIntegerField(default=CORPORATE)
|
org_type: int = models.PositiveSmallIntegerField(default=CORPORATE)
|
||||||
|
|
||||||
UPGRADE_TEXT_STANDARD = ugettext_lazy("Available on Zulip Standard. Upgrade to access.")
|
UPGRADE_TEXT_STANDARD = gettext_lazy("Available on Zulip Standard. Upgrade to access.")
|
||||||
# plan_type controls various features around resource/feature
|
# plan_type controls various features around resource/feature
|
||||||
# limitations for a Zulip organization on multi-tenant installations
|
# limitations for a Zulip organization on multi-tenant installations
|
||||||
# like Zulip Cloud.
|
# like Zulip Cloud.
|
||||||
|
@ -815,7 +815,7 @@ class RealmEmoji(models.Model):
|
||||||
# ending with one of the punctuation characters.
|
# ending with one of the punctuation characters.
|
||||||
RegexValidator(
|
RegexValidator(
|
||||||
regex=r"^[0-9a-z.\-_]+(?<![.\-_])$",
|
regex=r"^[0-9a-z.\-_]+(?<![.\-_])$",
|
||||||
message=ugettext_lazy("Invalid characters in emoji name"),
|
message=gettext_lazy("Invalid characters in emoji name"),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -1387,10 +1387,10 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
||||||
)
|
)
|
||||||
|
|
||||||
ROLE_ID_TO_NAME_MAP = {
|
ROLE_ID_TO_NAME_MAP = {
|
||||||
ROLE_REALM_OWNER: ugettext_lazy("Organization owner"),
|
ROLE_REALM_OWNER: gettext_lazy("Organization owner"),
|
||||||
ROLE_REALM_ADMINISTRATOR: ugettext_lazy("Organization administrator"),
|
ROLE_REALM_ADMINISTRATOR: gettext_lazy("Organization administrator"),
|
||||||
ROLE_MEMBER: ugettext_lazy("Member"),
|
ROLE_MEMBER: gettext_lazy("Member"),
|
||||||
ROLE_GUEST: ugettext_lazy("Guest"),
|
ROLE_GUEST: gettext_lazy("Guest"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_role_name(self) -> str:
|
def get_role_name(self) -> str:
|
||||||
|
@ -2338,9 +2338,9 @@ class AbstractReaction(models.Model):
|
||||||
REALM_EMOJI = "realm_emoji"
|
REALM_EMOJI = "realm_emoji"
|
||||||
ZULIP_EXTRA_EMOJI = "zulip_extra_emoji"
|
ZULIP_EXTRA_EMOJI = "zulip_extra_emoji"
|
||||||
REACTION_TYPES = (
|
REACTION_TYPES = (
|
||||||
(UNICODE_EMOJI, ugettext_lazy("Unicode emoji")),
|
(UNICODE_EMOJI, gettext_lazy("Unicode emoji")),
|
||||||
(REALM_EMOJI, ugettext_lazy("Custom emoji")),
|
(REALM_EMOJI, gettext_lazy("Custom emoji")),
|
||||||
(ZULIP_EXTRA_EMOJI, ugettext_lazy("Zulip extra emoji")),
|
(ZULIP_EXTRA_EMOJI, gettext_lazy("Zulip extra emoji")),
|
||||||
)
|
)
|
||||||
reaction_type: str = models.CharField(
|
reaction_type: str = models.CharField(
|
||||||
default=UNICODE_EMOJI, choices=REACTION_TYPES, max_length=30
|
default=UNICODE_EMOJI, choices=REACTION_TYPES, max_length=30
|
||||||
|
@ -3457,10 +3457,10 @@ class CustomProfileField(models.Model):
|
||||||
# and value argument. i.e. SELECT require field_data, USER require
|
# and value argument. i.e. SELECT require field_data, USER require
|
||||||
# realm as argument.
|
# realm as argument.
|
||||||
SELECT_FIELD_TYPE_DATA: List[ExtendedFieldElement] = [
|
SELECT_FIELD_TYPE_DATA: List[ExtendedFieldElement] = [
|
||||||
(SELECT, ugettext_lazy("List of options"), validate_select_field, str, "SELECT"),
|
(SELECT, gettext_lazy("List of options"), validate_select_field, str, "SELECT"),
|
||||||
]
|
]
|
||||||
USER_FIELD_TYPE_DATA: List[UserFieldElement] = [
|
USER_FIELD_TYPE_DATA: List[UserFieldElement] = [
|
||||||
(USER, ugettext_lazy("Person picker"), check_valid_user_ids, ast.literal_eval, "USER"),
|
(USER, gettext_lazy("Person picker"), check_valid_user_ids, ast.literal_eval, "USER"),
|
||||||
]
|
]
|
||||||
|
|
||||||
SELECT_FIELD_VALIDATORS: Dict[int, ExtendedValidator] = {
|
SELECT_FIELD_VALIDATORS: Dict[int, ExtendedValidator] = {
|
||||||
|
@ -3472,13 +3472,13 @@ class CustomProfileField(models.Model):
|
||||||
|
|
||||||
FIELD_TYPE_DATA: List[FieldElement] = [
|
FIELD_TYPE_DATA: List[FieldElement] = [
|
||||||
# Type, Display Name, Validator, Converter, Keyword
|
# Type, Display Name, Validator, Converter, Keyword
|
||||||
(SHORT_TEXT, ugettext_lazy("Short text"), check_short_string, str, "SHORT_TEXT"),
|
(SHORT_TEXT, gettext_lazy("Short text"), check_short_string, str, "SHORT_TEXT"),
|
||||||
(LONG_TEXT, ugettext_lazy("Long text"), check_long_string, str, "LONG_TEXT"),
|
(LONG_TEXT, gettext_lazy("Long text"), check_long_string, str, "LONG_TEXT"),
|
||||||
(DATE, ugettext_lazy("Date picker"), check_date, str, "DATE"),
|
(DATE, gettext_lazy("Date picker"), check_date, str, "DATE"),
|
||||||
(URL, ugettext_lazy("Link"), check_url, str, "URL"),
|
(URL, gettext_lazy("Link"), check_url, str, "URL"),
|
||||||
(
|
(
|
||||||
EXTERNAL_ACCOUNT,
|
EXTERNAL_ACCOUNT,
|
||||||
ugettext_lazy("External account"),
|
gettext_lazy("External account"),
|
||||||
check_short_string,
|
check_short_string,
|
||||||
str,
|
str,
|
||||||
"EXTERNAL_ACCOUNT",
|
"EXTERNAL_ACCOUNT",
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.contrib.auth.signals import user_logged_in, user_logged_out
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.utils.timezone import get_current_timezone_name as timezone_get_current_timezone_name
|
from django.utils.timezone import get_current_timezone_name as timezone_get_current_timezone_name
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from confirmation.models import one_click_unsubscribe_link
|
from confirmation.models import one_click_unsubscribe_link
|
||||||
from zerver.lib.actions import do_set_zoom_token
|
from zerver.lib.actions import do_set_zoom_token
|
||||||
|
|
|
@ -30,7 +30,7 @@ from typing import (
|
||||||
import orjson
|
import orjson
|
||||||
import tornado.ioloop
|
import tornado.ioloop
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from typing_extensions import TypedDict
|
from typing_extensions import TypedDict
|
||||||
|
|
||||||
from zerver.decorator import cachify
|
from zerver.decorator import cachify
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.exceptions import ErrorCode, JsonableError
|
from zerver.lib.exceptions import ErrorCode, JsonableError
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Iterable, Optional, Sequence
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, has_request_variables, internal_notify_view, process_client
|
from zerver.decorator import REQ, has_request_variables, internal_notify_view, process_client
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
|
|
|
@ -17,7 +17,7 @@ from django.shortcuts import redirect, render
|
||||||
from django.template.response import SimpleTemplateResponse
|
from django.template.response import SimpleTemplateResponse
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import is_safe_url
|
from django.utils.http import is_safe_url
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.decorators.http import require_safe
|
from django.views.decorators.http import require_safe
|
||||||
from social_django.utils import load_backend, load_strategy
|
from social_django.utils import load_backend, load_strategy
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden, HttpResponseNotFound
|
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden, HttpResponseNotFound
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.camo import is_camo_url_valid
|
from zerver.lib.camo import is_camo_url_valid
|
||||||
from zerver.lib.thumbnail import generate_thumbnail_url
|
from zerver.lib.thumbnail import generate_thumbnail_url
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from version import DESKTOP_MINIMUM_VERSION, DESKTOP_WARNING_VERSION
|
from version import DESKTOP_MINIMUM_VERSION, DESKTOP_WARNING_VERSION
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
|
|
|
@ -4,7 +4,7 @@ import orjson
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import human_users_only, require_realm_admin
|
from zerver.decorator import human_users_only, require_realm_admin
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, List, Set
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.actions import recipient_for_user_profiles
|
from zerver.lib.actions import recipient_for_user_profiles
|
||||||
from zerver.lib.addressee import get_user_profiles_by_ids
|
from zerver.lib.addressee import get_user_profiles_by_ids
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Dict, Iterable, Optional, Sequence
|
from typing import Dict, Iterable, Optional, Sequence
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.events import do_events_register
|
from zerver.lib.events import do_events_register
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import human_users_only
|
from zerver.decorator import human_users_only
|
||||||
from zerver.lib.actions import do_mark_hotspot_as_read
|
from zerver.lib.actions import do_mark_hotspot_as_read
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
from typing import List, Sequence, Set
|
from typing import List, Sequence, Set
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_member_or_admin, require_realm_admin
|
from zerver.decorator import require_member_or_admin, require_realm_admin
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import orjson
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, has_request_variables
|
from zerver.decorator import REQ, has_request_variables
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
|
|
@ -8,7 +8,7 @@ from django.core.exceptions import ValidationError
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.html import escape as escape_html
|
from django.utils.html import escape as escape_html
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
from sqlalchemy.dialects import postgresql
|
from sqlalchemy.dialects import postgresql
|
||||||
from sqlalchemy.engine import Connection, RowProxy
|
from sqlalchemy.engine import Connection, RowProxy
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, has_request_variables
|
from zerver.decorator import REQ, has_request_variables
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.core import validators
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, has_request_variables
|
from zerver.decorator import REQ, has_request_variables
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.actions import do_mute_topic, do_mute_user, do_unmute_topic, do_unmute_user
|
from zerver.lib.actions import do_mute_topic, do_mute_user, do_unmute_topic, do_unmute_user
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import human_users_only
|
from zerver.decorator import human_users_only
|
||||||
from zerver.lib.actions import do_update_user_status, update_user_presence
|
from zerver.lib.actions import do_update_user_status, update_user_presence
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import human_users_only
|
from zerver.decorator import human_users_only
|
||||||
from zerver.lib.push_notifications import (
|
from zerver.lib.push_notifications import (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, has_request_variables
|
from zerver.decorator import REQ, has_request_variables
|
||||||
from zerver.lib.actions import do_add_reaction, do_remove_reaction
|
from zerver.lib.actions import do_add_reaction, do_remove_reaction
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Optional, Union
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.decorators.http import require_safe
|
from django.views.decorators.http import require_safe
|
||||||
|
|
||||||
from confirmation.models import Confirmation, ConfirmationKeyException, get_object_from_key
|
from confirmation.models import Confirmation, ConfirmationKeyException, get_object_from_key
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_realm_admin
|
from zerver.decorator import require_realm_admin
|
||||||
from zerver.lib.actions import do_add_realm_domain, do_change_realm_domain, do_remove_realm_domain
|
from zerver.lib.actions import do_add_realm_domain, do_change_realm_domain, do_remove_realm_domain
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_member_or_admin
|
from zerver.decorator import require_member_or_admin
|
||||||
from zerver.lib.actions import check_add_realm_emoji, do_remove_realm_emoji
|
from zerver.lib.actions import check_add_realm_emoji, do_remove_realm_emoji
|
||||||
|
|
|
@ -4,7 +4,7 @@ import orjson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from analytics.models import RealmCount
|
from analytics.models import RealmCount
|
||||||
from zerver.decorator import require_realm_admin
|
from zerver.decorator import require_realm_admin
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_realm_admin
|
from zerver.decorator import require_realm_admin
|
||||||
from zerver.lib.actions import do_change_icon_source
|
from zerver.lib.actions import do_change_icon_source
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_realm_admin
|
from zerver.decorator import require_realm_admin
|
||||||
from zerver.lib.actions import do_add_linkifier, do_remove_linkifier
|
from zerver.lib.actions import do_add_linkifier, do_remove_linkifier
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_realm_admin
|
from zerver.decorator import require_realm_admin
|
||||||
from zerver.lib.actions import do_change_logo_source
|
from zerver.lib.actions import do_change_logo_source
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_realm_admin
|
from zerver.decorator import require_realm_admin
|
||||||
from zerver.lib.actions import do_add_realm_playground, do_remove_realm_playground
|
from zerver.lib.actions import do_add_realm_playground, do_remove_realm_playground
|
||||||
|
|
|
@ -13,7 +13,7 @@ from django.db.models import Q
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django_auth_ldap.backend import LDAPBackend, _LDAPUser
|
from django_auth_ldap.backend import LDAPBackend, _LDAPUser
|
||||||
|
|
||||||
from confirmation import settings as confirmation_settings
|
from confirmation import settings as confirmation_settings
|
||||||
|
|
|
@ -7,8 +7,8 @@ from django.contrib.auth.models import AnonymousUser
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import override as override_language
|
from django.utils.translation import override as override_language
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
|
|
||||||
from zerver.context_processors import get_valid_realm_from_request
|
from zerver.context_processors import get_valid_realm_from_request
|
||||||
from zerver.decorator import (
|
from zerver.decorator import (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import orjson
|
import orjson
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, has_request_variables
|
from zerver.decorator import REQ, has_request_variables
|
||||||
from zerver.lib.actions import do_add_submessage
|
from zerver.lib.actions import do_add_submessage
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden
|
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.thumbnail import generate_thumbnail_url
|
from zerver.lib.thumbnail import generate_thumbnail_url
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, has_request_variables
|
from zerver.decorator import REQ, has_request_variables
|
||||||
from zerver.lib.actions import check_send_typing_notification
|
from zerver.lib.actions import check_send_typing_notification
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden, HttpResponseNotFound
|
from django.http import HttpRequest, HttpResponse, HttpResponseForbidden, HttpResponseNotFound
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.cache import patch_cache_control
|
from django.utils.cache import patch_cache_control
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django_sendfile import sendfile
|
from django_sendfile import sendfile
|
||||||
|
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_member_or_admin, require_user_group_edit_permission
|
from zerver.decorator import require_member_or_admin, require_user_group_edit_permission
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
|
|
|
@ -8,8 +8,8 @@ from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.safestring import SafeString
|
from django.utils.safestring import SafeString
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import ugettext_lazy
|
from django.utils.translation import gettext_lazy
|
||||||
|
|
||||||
from confirmation.models import (
|
from confirmation.models import (
|
||||||
Confirmation,
|
Confirmation,
|
||||||
|
@ -46,7 +46,7 @@ from zerver.lib.validator import check_bool, check_int, check_int_in, check_stri
|
||||||
from zerver.models import UserProfile, avatar_changes_disabled, name_changes_disabled
|
from zerver.models import UserProfile, avatar_changes_disabled, name_changes_disabled
|
||||||
from zproject.backends import check_password_strength, email_belongs_to_ldap
|
from zproject.backends import check_password_strength, email_belongs_to_ldap
|
||||||
|
|
||||||
AVATAR_CHANGES_DISABLED_ERROR = ugettext_lazy("Avatar changes are disabled in this organization.")
|
AVATAR_CHANGES_DISABLED_ERROR = gettext_lazy("Avatar changes are disabled in this organization.")
|
||||||
|
|
||||||
|
|
||||||
def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpResponse:
|
def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, List, Optional, Union
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import require_member_or_admin, require_realm_admin
|
from zerver.decorator import require_member_or_admin, require_realm_admin
|
||||||
from zerver.forms import PASSWORD_TOO_WEAK_ERROR, CreateUserForm
|
from zerver.forms import PASSWORD_TOO_WEAK_ERROR, CreateUserForm
|
||||||
|
|
|
@ -14,7 +14,7 @@ from django.http import HttpRequest, HttpResponse
|
||||||
from django.middleware import csrf
|
from django.middleware import csrf
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
from django.utils.crypto import constant_time_compare, salted_hmac
|
from django.utils.crypto import constant_time_compare, salted_hmac
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.decorators.cache import never_cache
|
from django.views.decorators.cache import never_cache
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
|
|
|
@ -8,7 +8,7 @@ from typing import Optional
|
||||||
import orjson
|
import orjson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import authenticated_json_view
|
from zerver.decorator import authenticated_json_view
|
||||||
from zerver.lib.ccache import make_ccache
|
from zerver.lib.ccache import make_ccache
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict, Tuple
|
from typing import Any, Dict, Tuple
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, List, Tuple
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any, Dict, List, Optional, Tuple
|
||||||
import orjson
|
import orjson
|
||||||
from defusedxml.ElementTree import fromstring as xml_fromstring
|
from defusedxml.ElementTree import fromstring as xml_fromstring
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.actions import check_send_stream_message
|
from zerver.lib.actions import check_send_stream_message
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import InvalidJSONError
|
from zerver.lib.exceptions import InvalidJSONError
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Webhooks for external integrations.
|
# Webhooks for external integrations.
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, has_request_variables, webhook_view
|
from zerver.decorator import REQ, has_request_variables, webhook_view
|
||||||
from zerver.lib.actions import send_rate_limited_pm_notification_to_bot_owner
|
from zerver.lib.actions import send_rate_limited_pm_notification_to_bot_owner
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from zerver.decorator import webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
|
|
|
@ -40,8 +40,8 @@ from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import override as override_language
|
from django.utils.translation import override as override_language
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from sentry_sdk import add_breadcrumb, configure_scope
|
from sentry_sdk import add_breadcrumb, configure_scope
|
||||||
from zulip_bots.lib import extract_query_without_mention
|
from zulip_bots.lib import extract_query_without_mention
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ from django.core.validators import URLValidator, validate_email
|
||||||
from django.db import IntegrityError, transaction
|
from django.db import IntegrityError, transaction
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import ugettext as err_
|
from django.utils.translation import gettext as err_
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS
|
from analytics.lib.counts import COUNT_STATS
|
||||||
|
|
|
@ -30,7 +30,7 @@ from django.dispatch import Signal, receiver
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django_auth_ldap.backend import LDAPBackend, LDAPReverseEmailSearch, _LDAPUser, ldap_error
|
from django_auth_ldap.backend import LDAPBackend, LDAPReverseEmailSearch, _LDAPUser, ldap_error
|
||||||
from lxml.etree import XMLSyntaxError
|
from lxml.etree import XMLSyntaxError
|
||||||
from onelogin.saml2.errors import OneLogin_Saml2_Error
|
from onelogin.saml2.errors import OneLogin_Saml2_Error
|
||||||
|
|
Loading…
Reference in New Issue