mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 01:35:07 -04:00
Introduce a Requester object
This tracks data about the entity which made the request. This is instead of passing around a tuple, which requires call-site modifications every time a new piece of optional context is passed around. I tried to introduce a User object. I gave up.
This commit is contained in:
parent
fcbe63eaad
commit
2110e35fd6
24 changed files with 178 additions and 144 deletions
|
@ -70,7 +70,7 @@ class UploadResource(BaseMediaResource):
|
|||
@request_handler
|
||||
@defer.inlineCallbacks
|
||||
def _async_render_POST(self, request):
|
||||
auth_user, _, _ = yield self.auth.get_user_by_req(request)
|
||||
requester = yield self.auth.get_user_by_req(request)
|
||||
# TODO: The checks here are a bit late. The content will have
|
||||
# already been uploaded to a tmp file at this point
|
||||
content_length = request.getHeader("Content-Length")
|
||||
|
@ -110,7 +110,7 @@ class UploadResource(BaseMediaResource):
|
|||
|
||||
content_uri = yield self.create_content(
|
||||
media_type, upload_name, request.content.read(),
|
||||
content_length, auth_user
|
||||
content_length, requester.user
|
||||
)
|
||||
|
||||
respond_with_json(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue