mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
REQ: Ensure only initial parameter is positional & adjust views/messages.py.
This commit is contained in:
committed by
Greg Price
parent
b0126ca8dc
commit
16b939a964
@@ -48,7 +48,7 @@ class REQ:
|
||||
pass
|
||||
NotSpecified = _NotSpecified()
|
||||
|
||||
def __init__(self, whence: str=None, converter: Callable[[Any], Any]=None,
|
||||
def __init__(self, whence: str=None, *, converter: Callable[[Any], Any]=None,
|
||||
default: Any=NotSpecified, validator: Callable[[Any], Any]=None,
|
||||
argument_type: str=None) -> None:
|
||||
"""whence: the name of the request variable that should be used
|
||||
|
||||
@@ -23,6 +23,7 @@ class _NotSpecified: ...
|
||||
NotSpecified = _NotSpecified()
|
||||
|
||||
def REQ(whence: Optional[str] = None,
|
||||
*,
|
||||
converter: Optional[Callable[[str], ResultT]] = None,
|
||||
default: Union[_NotSpecified, ResultT] = NotSpecified,
|
||||
validator: Optional[Validator] = None,
|
||||
|
||||
@@ -948,7 +948,8 @@ def send_message_backend(request: HttpRequest, user_profile: UserProfile,
|
||||
message_type_name: Text=REQ('type'),
|
||||
message_to: List[Text]=REQ('to', converter=extract_recipients, default=[]),
|
||||
forged: bool=REQ(default=False),
|
||||
topic_name: Optional[Text]=REQ('subject', lambda x: x.strip(), None),
|
||||
topic_name: Optional[Text]= REQ('subject',
|
||||
converter=lambda x: x.strip(), default=None),
|
||||
message_content: Text=REQ('content'),
|
||||
realm_str: Optional[Text]=REQ('realm_str', default=None),
|
||||
local_id: Optional[Text]=REQ(default=None),
|
||||
|
||||
Reference in New Issue
Block a user