You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bloodhound.apache.org by Gary Martin <ga...@wandisco.com> on 2013/04/30 21:31:08 UTC

Re: svn commit: r1477773 - /bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py

Hi,

I found this little problem interesting. I have put a workaround in 
place but I have not gotten around to identifying the underlying cause 
and whether we are likely to see more of these kinds of problem. I have 
left https://issues.apache.org/bloodhound/ticket/512 in a review state 
for now.

Cheers,
     Gary

On 30/04/13 19:45, gjm@apache.org wrote:
> Author: gjm
> Date: Tue Apr 30 18:45:35 2013
> New Revision: 1477773
>
> URL: http://svn.apache.org/r1477773
> Log:
> storing super on the ProductizedHref as a workaround for TypeError on attempting to call a super() method - #512
>
> Modified:
>      bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py
>
> Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py
> URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py?rev=1477773&r1=1477772&r2=1477773&view=diff
> ==============================================================================
> --- bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py (original)
> +++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py Tue Apr 30 18:45:35 2013
> @@ -84,7 +84,8 @@ class ProductizedHref(Href):
>                          'img/',
>                          ]
>       def __init__(self, global_href, base):
> -        super(ProductizedHref, self).__init__(base)
> +        self.super = super(ProductizedHref, self)
> +        self.super.__init__(base)
>           self._global_href = global_href
>   
>       def __call__(self, *args, **kwargs):
> @@ -93,7 +94,7 @@ class ProductizedHref(Href):
>                  (len(args) == 1 and args[0] == 'admin') or \
>                  filter(lambda x: args[0].startswith(x), self.STATIC_PREFIXES):
>                   return self._global_href(*args, **kwargs)
> -        return super(ProductizedHref, self).__call__(*args, **kwargs)
> +        return self.super.__call__(*args, **kwargs)
>   
>   class ProductRequestWithSession(RequestWithSession):
>       def __init__(self, env, environ, start_response):
>
>


Re: svn commit: r1477773 - /bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py

Posted by Gary Martin <ga...@wandisco.com>.
On 01/05/13 18:03, Branko Čibej wrote:
> On 30.04.2013 21:31, Gary Martin wrote:
>> Hi,
>>
>> I found this little problem interesting. I have put a workaround in
>> place but I have not gotten around to identifying the underlying cause
>> and whether we are likely to see more of these kinds of problem. I
>> have left https://issues.apache.org/bloodhound/ticket/512 in a review
>> state for now.
> Has someone been playing games with class identity? I suspect so ...

I was wondering if it might be some kind of reimporting or something.

> In any case I'd store super(x, y).__call__ instead of just the super
> reference.

That might well be better but it still strikes me as even better to fix 
the cause to get rid of the need for storing anything extra. I might 
look into that if I find some time but if anyone wants to take over the 
investigation, feel free to take over 
https://issues.apache.org/bloodhound/ticket/512 so that I don't 
accidentally duplicate effort.

Cheers,
     Gary

Re: svn commit: r1477773 - /bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py

Posted by Olemis Lang <ol...@gmail.com>.
On 5/1/13, Branko Čibej <br...@wandisco.com> wrote:
> On 30.04.2013 21:31, Gary Martin wrote:
>> Hi,
>>
>> I found this little problem interesting. I have put a workaround in
>> place but I have not gotten around to identifying the underlying cause
>> and whether we are likely to see more of these kinds of problem. I
>> have left https://issues.apache.org/bloodhound/ticket/512 in a review
>> state for now.
>
> Has someone been playing games with class identity? I suspect so ...
>

I've had no much time to dig into this (working on #513 now) but
definitely there's more to improve about this . I quite agree with
putting ticket into review state atm .

-- 
Regards,

Olemis.

Re: svn commit: r1477773 - /bloodhound/trunk/bloodhound_multiproduct/multiproduct/hooks.py

Posted by Branko Čibej <br...@wandisco.com>.
On 30.04.2013 21:31, Gary Martin wrote:
> Hi,
>
> I found this little problem interesting. I have put a workaround in
> place but I have not gotten around to identifying the underlying cause
> and whether we are likely to see more of these kinds of problem. I
> have left https://issues.apache.org/bloodhound/ticket/512 in a review
> state for now.

Has someone been playing games with class identity? I suspect so ...

In any case I'd store super(x, y).__call__ instead of just the super
reference.

Looking at that code some more, I wonder if it wouldn't be better to
make PATHS_NO_TRANSFORM a frozenset -- the O(n) vs. O(log n) could make
itself felt over time.

Not sure if STATIC_PREFIXES should be a compiled regex instead of a
list; in theory a regex should be faster, but probably not worth it in
this case.

-- Brane

-- 
Branko Čibej
Director of Subversion | WANdisco | www.wandisco.com