8000 Key function for addressing children/elements · Issue #15 · lvh/txyoga · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Key function for addressing children/elements #15
Open
@lvh

Description

@lvh

URLs encode bytes. Usually, children of elements and elements of collections have Unicode identifiers, though. Currently this is "fixed" by Python's implicit decoding, which is pretty bad.

Since URLs are an implementation detail of being accessed over HTTP, this belongs in {Collection,Element}Resource.

There should be a test that tries a non-ASCII name first, and verifies that it works when you use lambda s: s.decode("utf-8") as a key function.

Whether the default should be lambda s: s.decode("utf-8") or lambda s: s (or perhaps a special-cased None) is an open question. UTF-8 is probably the only sane default encoding. The API should provide a keyfunc and not an encoding, because using int as a key function for example might make perfect sense.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0