• Glyph [2024-12-28 07:12]:
Yep, that's definitely wrong, thank you for spotting it! I suspect you may
find other type-confusion problems in the docs, which don't really have
type-checking or testing applied to them.
-g
It wasn't just spotting it, it was wondering for quite a while _why_ it
didn't work.
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:
* ":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.
On Dec 26, 2024, at 2:04 PM, Kirill Miazine <k...@krot.org> wrote:
While browsing through the twisted.web docs, I noticed following:
Hello's getChild() method on
https://docs.twisted.org/en/stable/web/howto/using-twistedweb.html#resource-objects
has a typo. It says
if name == '':
where it should have said:
if name == b'':
_______________________________________________
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/SR2WXQPQS62VNUQGW3RKGWV7VILGYJIR/
Code of Conduct: https://twisted.org/conduct