#579: ProductizedHref fails for dicts as first argument
---------------------------+-----------------------
Reporter: olemis | Owner: nobody
Type: defect | Status: new
Priority: major | Milestone: Release 7
Component: multiproduct | Version:
Resolution: | Keywords: web href
---------------------------+-----------------------
Changes (by olemis):
* component: => multiproduct
* keywords: => web href
* milestone: => Release 7
* owner: => nobody
Old description:
> Productized Href breaks Href contract when dict objects are passed as
> first argument.
New description:
Productized Href breaks Href contract when dict objects are passed as
first argument. See sample code below
{{{!#py
>>> from trac.web.href import Href
>>> h = Href('/x/y')
>>> p = dict(a=1,b=2,c=3)
>>> h(p)
'/x/y?a=1&c=3&b=2'
>>> from multiproduct.hooks import ProductizedHref
>>> help(ProductizedHref)
>>> help(ProductizedHref)
>>> phref = ProductizedHref(h, 'z')
>>> phref(p)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "multiproduct/hooks.py", line 106, in __call__
filter(lambda x: args[0].startswith(x), self.STATIC_PREFIXES):
File "multiproduct/hooks.py", line 106, in <lambda>
filter(lambda x: args[0].startswith(x), self.STATIC_PREFIXES):
AttributeError: 'dict' object has no attribute 'startswith'
}}}
--
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/579#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker