Skip to content

Accommodate sites where middleware toggles between URL configurations. #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

nyergler
Copy link
Contributor

This commit creates a new URL configuration when adding the debug toolbar URLs and then caches it by name. This accommodates sites where other middleware may change the URL configuration between two requests. Previously the first request's url configuration would "win".

@dcramer
Copy link
Contributor

dcramer commented May 16, 2011

What was the reasoning behind copying the url patterns?

@nyergler
Copy link
Contributor Author

To avoid changing them in place. I guess I'm not sure if urlpatterns are immutable, now that I think about it.

@dcramer
Copy link
Contributor

dcramer commented May 17, 2011

Ah that makes sense. It wasn't obvious to me since it was the DJDT url conf that was being copied, rather than the original.

@nyergler
Copy link
Contributor Author

Just did some looking, and I'm no longer certain that the copy is needed; looks like concatenation may be enough to make a new copy of the patterns object. I'll take a look at it tomorrow and update the pull request.

nyergler added 5 commits May 21, 2011 08:26
This accomodates sites where middleware may change the urlconf for two
different request.
find_template_and_decorate will decorate the render method of Template
classes in order to emit signals needed by Django Debug Toolbar.
@nyergler
Copy link
Contributor Author

I've updated our branch to avoid the need to copy. Pulling in d7a1124 and 0e301e3 should make DjDT work with per request urlconfs.

@dcramer
Copy link
Contributor

dcramer commented May 25, 2011

Looks like there's some extra commits in here. Will try to get a selective merge done tomorrow.

@nyergler
Copy link
Contributor Author

The extra commits are to make DjDT work with non-Django templates (>=1.2). We (Eventbrite) would love to see those merged, too.

To make things easier I created a feature-branch merge request (#165). I'll create a feature-branch merge request for the other functionality once we've done some more testing.

@nyergler nyergler closed this May 25, 2011
@dcramer
Copy link
Contributor

dcramer commented May 26, 2011

@nyergler thanks -- I didn't have time to dig through in in full detail today (I want to ensure I've added proper test coverage when merging it), but I'm hoping to before this week is up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants