-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Move v1-only APIs into their own module & isolate deprecated ones #3460
Changes from 11 commits
5280327
b2a2fb2
30e6719
b0a86d0
299e97a
1467830
c25cd2a
5de3d21
f05eddf
25daf4e
b3cd795
ae401df
79a89bd
c47aa73
500e07e
ab6796c
df4f29a
8943685
5c8a914
1a3fe4e
abc171f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -832,10 +832,13 @@ def register_servlets(hs, http_server): | |
RoomSendEventRestServlet(hs).register(http_server) | ||
PublicRoomListRestServlet(hs).register(http_server) | ||
RoomStateRestServlet(hs).register(http_server) | ||
RoomInitialSyncRestServlet(hs).register(http_server) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, this can't be removed because it's used for peeking. |
||
RoomRedactEventRestServlet(hs).register(http_server) | ||
RoomTypingRestServlet(hs).register(http_server) | ||
SearchRestServlet(hs).register(http_server) | ||
JoinedRoomsRestServlet(hs).register(http_server) | ||
RoomEventServlet(hs).register(http_server) | ||
RoomEventContextServlet(hs).register(http_server) | ||
|
||
|
||
def register_deprecated_servlets(hs, http_server): | ||
RoomInitialSyncRestServlet(hs).register(http_server) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2014-2016 OpenMarket Ltd | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this could do with updating There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""This module contains base REST classes for constructing client v1 servlets. | ||
""" | ||
|
||
import re | ||
|
||
from synapse.api.urls import CLIENT_PREFIX | ||
|
||
|
||
def v1_only_client_path_patterns(path_regex, include_in_unstable=True): | ||
"""Creates a regex compiled client path with the correct client path | ||
prefix. | ||
|
||
Args: | ||
path_regex (str): The regex string to match. This should NOT have a ^ | ||
as this will be prefixed. | ||
Returns: | ||
SRE_Pattern | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like it returns a list to me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
""" | ||
patterns = [re.compile("^" + CLIENT_PREFIX + path_regex)] | ||
if include_in_unstable: | ||
unstable_prefix = CLIENT_PREFIX.replace("/api/v1", "/unstable") | ||
patterns.append(re.compile("^" + unstable_prefix + path_regex)) | ||
return patterns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is duplicated below, and probably can't actually be made PY2-only, because it provides https://matrix.org/docs/spec/client_server/unstable.html#id95, which isn't deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yeah. Fixed.