• Glyph [2024-12-29 01:48]:
[...]>> Actually, I was slightly surprised that child names are using bytes
and not strings: I am used to decode() as early as possible, deal with
strings, and then encode() as late as possible. So URL parts being
bytes felt kind of weird, and certainly a surprise that could bite a
novice.
Actually, the howto page needs a review, as it's rather consistently
saying "strings" where bytes are expected:
Sadly, a lot of the documentation is like this. And the resource model
itself needs a revisit; these were bytes because bytes were strings 20
years ago. Twisted's HTTP server was originally built on HTTP/0.9, and
it really shows sometimes :).
Uh-oh.
We need an overhaul that can do things like handle incremental uploads
as well. See <https://github.com/twisted/twisted/issues/4688 <https://
github.com/twisted/twisted/issues/4688>> and the cluster of related issues.
* ":ref:`Resource rendering <web-howto-using-twistedweb-rendering>`
occurs when Twisted Web locates a leaf Resource object. A Resource can
either return an html [STRING] or write to the request object."
* "A Resource can know where it is in the URL tree by looking at
request.prepath , a list of URL segment [STRINGS]."
* "If the URL ends in a slash, for example http://example.com/foo/
bar/ , the final URL segment will be an empty [STRING]."
* "Resource rendering occurs when Twisted Web locates a leaf Resource
object to handle a web request. A Resource's render method may do
various things to produce output which will be sent back to the browser:
- Return a [STRING]"
I've made an issue on github, so it's not forgotten: https://
github.com/twisted/twisted/issues/12409. I could probably as well
suggest some changes to the wordings, but I have to figure out how
github works -- apparently sending patches is now how it's done nowadays.
Not sure if by "sending patches" you mean "making pull requests" :).
I'd really prefer to send a good old patch, but here you go:
https://github.com/twisted/twisted/pull/12410
_______________________________________________
Twisted mailing list -- twisted@python.org
To unsubscribe send an email to twisted-le...@python.org
https://mail.python.org/mailman3/lists/twisted.python.org/
Message archived at
https://mail.python.org/archives/list/twisted@python.org/message/FP4BFKLCWO5IVEPHOVESTJYGT77RO4E6/
Code of Conduct: https://twisted.org/conduct