Open
Description
Let's look at a template like this:
http://example.com/dictionary/{term:1}
We have two different behaviours depending upon the value used to expand term
.
>>> import uritemplate
>>> u = uritemplate.URITemplate('http://example.com/dictionary/{term:1}')
>>> u.expand(term='foo')
'http://example.com/dictionary/f'
>>> u.expand(term=['foo', 'bar', 'bogus'])
'http://example.com/dictionary/foo,bar,bogus'
A simplified version of this is simply
{term:1}
In other words:
>>> import uritemplate
>>> u = uritemplate.URITemplate('{term:1}')
>>> u.expand(term='foo')
'f'
>>> u.expand(term=['foo', 'bar', 'bogus'])
'foo,bar,bogus'
All versions of uritemplate
(and uritemplate.py
) exhibit this behaviour and the RFC does not provide clear guidance.
I have not investigated how other implementations in other languages handle this, though. There do not appear to be any examples in the RFC that combine lists with length limitations.
Metadata
Metadata
Assignees
Labels
No labels