Closed mjtorn closed 11 years ago
Hey sorry, I think it's best to revert. I got confused over the old code base, it appears you must return the context in this case and until the issue with recursion is solved, this is not a good state for the code. I'll update this PR asap!
Do you happen to have a working test for this? I can confirm the correct _numpages in PaginateNode. It may be because of something we do, but considering there was already confusion and a test that didn't execute, it would be nice to hear a second opinion :) Thanks!
Wrote a test case for us which looks for both certain rendered variables from django-paginator's context and all that, it works.
I don't have any tests for this sadly (I'm not using it anymore and the extent that I did use it was limited).
BTW: do you still want this to land?
Sure, it helps against the current master, the confused code is reverted, the last one is a slight cleanup and now it's at least possible for someone (probably not me, I'm afraid) to look at setup.py test.
I found one issue but that's present even in your 0550c50 so I have to see if it's our code or not. Not today, haven't been feeling well and it's getting late.
As it stands, this PR is good to go IMO.
I have
django.template.context in has_key
RuntimeError: maximum recursion depth exceeded while calling a Python object
with this PR merged.
Whole exception looks like this
I'm sorry about that.
I don't actively maintain this project anymore but I will gladly merge patches to issues that affect its users. Can you work on a fix for this?
@zyga I'll try, but can't be sure about my skills… Also i ping'd stylesen in IRC channel, maybe he can consult me with this issue… Will work on this right now.
Found the bug. Blame this commit: b5f7065624d3f212ef9e22911478011789cc32b0 Don't know how to explain or revert it, though… I'm too newbie on this :(
It would appear I'm guilty as charged. After 10 months it's hard to remember anything that's happened and this works for us... The commit itself looks inconspicuous enough.
Do you have a concrete test case I could run against git bisect to see what's up?
Thanks!
@mjtorn set PAGINATION_INVALID_PAGE_RAISES_404
to False
, go to page with pagination, set page
URI param to unexisting page number.
In normal way it just should not list any items, but show the page. With current master it will be RuntimeError
.
Sorry for providing use-case so lately
Ok, sorry for unprofessional behaviour of mine, it seems I figured it out.
Django's render_to_string()
method awaits second argument (new_context
in our case) to be dictionary, not Context
instance. So when it tries to render template with this "dictionary" - it puts new Context
instance within original Context
instance, and the magic happens…
I found a bug with returning context, so the master was broken for a while :(
Not sure why, but returning the context there caused infinite recursion. The code is now cleaner and avoids this issue.
I also fixed the test settings so it's possible to run setup.py test but the cases don't pass. This appears to be an expected situation, as they don't pass in the upstream version?
Thanks!