mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Remove rest_dispatch hack and optimize imports.
For a long time, rest_dispatch has had this hack where we have to create a copy of it in each views file using it, in order to directly access the globals list in that file. This removes that hack, instead making rest_dispatch just use Django's import_string to access the target method to use. [tweaked and reorganized from acrefoot's original branch in various ways by tabbott]
This commit is contained in:
@@ -5,7 +5,6 @@ from django.utils.translation import ugettext as _
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
from zerver.lib.request import JsonableError, REQ, has_request_variables
|
||||
from zerver.decorator import authenticated_json_post_view, \
|
||||
@@ -29,12 +28,9 @@ from collections import defaultdict
|
||||
import ujson
|
||||
from six.moves import urllib
|
||||
|
||||
from zerver.lib.rest import rest_dispatch as _rest_dispatch
|
||||
import six
|
||||
from six import text_type
|
||||
|
||||
rest_dispatch = csrf_exempt((lambda request, *args, **kwargs: _rest_dispatch(request, globals(), *args, **kwargs)))
|
||||
|
||||
def list_to_streams(streams_raw, user_profile, autocreate=False, invite_only=False):
|
||||
# type: (Iterable[text_type], UserProfile, Optional[bool], Optional[bool]) -> Tuple[List[Stream], List[Stream]]
|
||||
"""Converts plaintext stream names to a list of Streams, validating input in the process
|
||||
|
||||
Reference in New Issue
Block a user