mirror of https://github.com/zulip/zulip.git
Remove usage of six.moves.text_type.
This commit is contained in:
parent
65838bb825
commit
bb46bea44d
|
@ -51,7 +51,6 @@ from urllib.parse import urljoin, urlencode
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from configparser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
from six import text_type
|
|
||||||
|
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
|
@ -93,7 +92,7 @@ def process_response_error(e):
|
||||||
|
|
||||||
|
|
||||||
def send_email_mirror(rcpt_to, shared_secret, host, url, test, verify_ssl):
|
def send_email_mirror(rcpt_to, shared_secret, host, url, test, verify_ssl):
|
||||||
# type: (text_type, text_type, text_type, text_type, bool, bool) -> None
|
# type: (str, str, str, str, bool, bool) -> None
|
||||||
if not rcpt_to:
|
if not rcpt_to:
|
||||||
print("5.1.1 Bad destination mailbox address: No missed message email address.")
|
print("5.1.1 Bad destination mailbox address: No missed message email address.")
|
||||||
exit(posix.EX_NOUSER) # type: ignore # There are no stubs for posix in python 3
|
exit(posix.EX_NOUSER) # type: ignore # There are no stubs for posix in python 3
|
||||||
|
|
|
@ -6,7 +6,6 @@ from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from six import text_type
|
|
||||||
from typing import Dict, Any, Optional
|
from typing import Dict, Any, Optional
|
||||||
|
|
||||||
def body_template(score: int) -> str:
|
def body_template(score: int) -> str:
|
||||||
|
@ -21,7 +20,7 @@ def api_delighted_webhook(request, user_profile,
|
||||||
payload=REQ(argument_type='body'),
|
payload=REQ(argument_type='body'),
|
||||||
stream=REQ(default='delighted'),
|
stream=REQ(default='delighted'),
|
||||||
topic=REQ(default='Survey Response')):
|
topic=REQ(default='Survey Response')):
|
||||||
# type: (HttpRequest, UserProfile, Dict[str, Dict[str, Any]], text_type, text_type) -> HttpResponse
|
# type: (HttpRequest, UserProfile, Dict[str, Dict[str, Any]], str, str) -> HttpResponse
|
||||||
person = payload['event_data']['person']
|
person = payload['event_data']['person']
|
||||||
selected_payload = {'email': person['email']}
|
selected_payload = {'email': person['email']}
|
||||||
selected_payload['score'] = payload['event_data']['score']
|
selected_payload['score'] = payload['event_data']['score']
|
||||||
|
|
|
@ -7,7 +7,6 @@ from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from six import text_type
|
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
def format_body(signatories: List[Dict[str, Any]], model_payload: Dict[str, Any]) -> str:
|
def format_body(signatories: List[Dict[str, Any]], model_payload: Dict[str, Any]) -> str:
|
||||||
|
@ -45,7 +44,7 @@ def api_hellosign_webhook(request, user_profile,
|
||||||
payload=REQ(argument_type='body'),
|
payload=REQ(argument_type='body'),
|
||||||
stream=REQ(default='hellosign'),
|
stream=REQ(default='hellosign'),
|
||||||
topic=REQ(default=None)):
|
topic=REQ(default=None)):
|
||||||
# type: (HttpRequest, UserProfile, Dict[str, Dict[str, Any]], text_type, text_type) -> HttpResponse
|
# type: (HttpRequest, UserProfile, Dict[str, Dict[str, Any]], str, str) -> HttpResponse
|
||||||
model_payload = ready_payload(payload['signature_request']['signatures'], payload)
|
model_payload = ready_payload(payload['signature_request']['signatures'], payload)
|
||||||
body = format_body(payload['signature_request']['signatures'], model_payload)
|
body = format_body(payload['signature_request']['signatures'], model_payload)
|
||||||
topic = topic or model_payload['contract_title']
|
topic = topic or model_payload['contract_title']
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from zerver.lib.test_classes import WebhookTestCase
|
from zerver.lib.test_classes import WebhookTestCase
|
||||||
from six import text_type
|
|
||||||
|
|
||||||
|
|
||||||
class SlackWebhookTests(WebhookTestCase):
|
class SlackWebhookTests(WebhookTestCase):
|
||||||
|
@ -52,6 +51,6 @@ class SlackWebhookTests(WebhookTestCase):
|
||||||
result = self.client_post(url, payload, content_type="application/x-www-form-urlencoded")
|
result = self.client_post(url, payload, content_type="application/x-www-form-urlencoded")
|
||||||
self.assert_json_error(result, 'Error: channels_map_to_topics parameter other than 0 or 1')
|
self.assert_json_error(result, 'Error: channels_map_to_topics parameter other than 0 or 1')
|
||||||
|
|
||||||
def get_body(self, fixture_name: text_type) -> text_type:
|
def get_body(self, fixture_name: str) -> str:
|
||||||
|
|
||||||
return self.fixture_data("slack", fixture_name, file_type="txt")
|
return self.fixture_data("slack", fixture_name, file_type="txt")
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from six import text_type
|
|
||||||
from zerver.lib.test_classes import WebhookTestCase
|
from zerver.lib.test_classes import WebhookTestCase
|
||||||
from zerver.models import get_realm, get_user
|
from zerver.models import get_realm, get_user
|
||||||
|
|
||||||
|
@ -89,5 +88,5 @@ class WordPressHookTests(WebhookTestCase):
|
||||||
|
|
||||||
self.assert_json_error(result, "Unknown WordPress webhook action: WordPress Action")
|
self.assert_json_error(result, "Unknown WordPress webhook action: WordPress Action")
|
||||||
|
|
||||||
def get_body(self, fixture_name: text_type) -> text_type:
|
def get_body(self, fixture_name: str) -> str:
|
||||||
return self.fixture_data("wordpress", fixture_name, file_type="txt")
|
return self.fixture_data("wordpress", fixture_name, file_type="txt")
|
||||||
|
|
|
@ -8,8 +8,6 @@ from zerver.lib.response import json_success, json_error
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.models import get_client, UserProfile
|
from zerver.models import get_client, UserProfile
|
||||||
|
|
||||||
from six import text_type
|
|
||||||
|
|
||||||
PUBLISH_POST_OR_PAGE_TEMPLATE = 'New {type} published.\n[{title}]({url})'
|
PUBLISH_POST_OR_PAGE_TEMPLATE = 'New {type} published.\n[{title}]({url})'
|
||||||
USER_REGISTER_TEMPLATE = 'New blog user registered.\nName: {name}\nemail: {email}'
|
USER_REGISTER_TEMPLATE = 'New blog user registered.\nName: {name}\nemail: {email}'
|
||||||
WP_LOGIN_TEMPLATE = 'User {name} logged in.'
|
WP_LOGIN_TEMPLATE = 'User {name} logged in.'
|
||||||
|
@ -26,7 +24,7 @@ def api_wordpress_webhook(request, user_profile,
|
||||||
display_name=REQ(default="New User Name"),
|
display_name=REQ(default="New User Name"),
|
||||||
user_email=REQ(default="New User Email"),
|
user_email=REQ(default="New User Email"),
|
||||||
user_login=REQ(default="Logged in User")):
|
user_login=REQ(default="Logged in User")):
|
||||||
# type: (HttpRequest, UserProfile, text_type, text_type, text_type, text_type, text_type, text_type, text_type, text_type, text_type) -> HttpResponse
|
# type: (HttpRequest, UserProfile, str, str, str, str, str, str, str, str, str) -> HttpResponse
|
||||||
|
|
||||||
# remove trailing whitespace (issue for some test fixtures)
|
# remove trailing whitespace (issue for some test fixtures)
|
||||||
hook = hook.rstrip()
|
hook = hook.rstrip()
|
||||||
|
|
Loading…
Reference in New Issue