Skip to content

Python: Model twisted#6045

Merged
yoff merged 6 commits intogithub:mainfrom
RasmusWL:twisted
Jun 21, 2021
Merged

Python: Model twisted#6045
yoff merged 6 commits intogithub:mainfrom
RasmusWL:twisted

Conversation

@RasmusWL
Copy link
Member

@RasmusWL RasmusWL commented Jun 8, 2021

No description provided.

@RasmusWL RasmusWL requested a review from a team as a code owner June 8, 2021 16:30
Copy link
Contributor

@yoff yoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a number of patterns on https://twistedmatrix.com/, but we only really deal with "web server". This seems to be intentional, given the change note, but I wanted to double check :-)

Comment on lines 69 to 72
exists(int i |
resourceMethodRequestParamIndex(this.getName(), i) and
result = this.getArg(i)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If resourceMethodRequestParamIndex were to return the index rather than take it as a second parameter, this bit could be written as result = this.getArg(resourceMethodRequestParamIndex(this.getName())).

It would mean that resourceMethodRequestParamIndex(result.getName(), _) would have to be changed to exists(resourceMethodRequestParamIndex(result.getName()), which is longer but does read a bit more explicitly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind much, but it was not a hard change, so there it is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks.


def process_later(request: Request):
print("process_later called")
request.write(b"later") # $ MISSING: responseBody=b"later"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this missing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because process_later is invoked through reactor.callLater(1, process_later, request), and we currently have no way to simulate this call happening.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see now. TwistedResourceRequestHendler would have to close under such delegating calls. I think it is fine to just have the test case documenting the limitation for now.

Co-authored-by: yoff <lerchedahl@gmail.com>
@RasmusWL
Copy link
Member Author

There are a number of patterns on https://twistedmatrix.com/, but we only really deal with "web server". This seems to be intentional, given the change note, but I wanted to double check :-)

yes, this is intentional. Just like for aiohttp we only dealt with the aiohttp.web part 👍

@RasmusWL RasmusWL dismissed a stale review via d6ec4d3 June 21, 2021 08:54
@RasmusWL RasmusWL requested a review from yoff June 21, 2021 08:56
Copy link
Contributor

@yoff yoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yoff yoff merged commit baf8d0a into github:main Jun 21, 2021
@RasmusWL RasmusWL deleted the twisted branch June 21, 2021 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants