Skip to content
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

Why is Breadcrumbs a Singleton? #12

Open
sclaughl opened this issue Oct 28, 2013 · 5 comments
Open

Why is Breadcrumbs a Singleton? #12

sclaughl opened this issue Oct 28, 2013 · 5 comments

Comments

@sclaughl
Copy link

I notice Breadcrumbs is a singleton. Won't this give each user on the system the same breadcrumb trail? That is not desirable, is it?

Also, why does the middleware's process_request call the _clean method? Doesn't that dump all the existing crumbs, thereby leaving only the single crumb added by the view, thereby defeating the purpose of breadcrumbs?

Am I missing something about how this application is intended to be used?

Thanks,

--Stuart

@chronossc
Copy link
Owner

Hello Stuart.

I will make tests trying to reproduce points that you wrote at this issue.

I will not reply all questions here because I wrote breadcrumbs have many years and don't remember everything about code now, but about singleton, as I remember, I used a singleton with idea of have one breadcrumbs instance over all request, and never experienced 'cross breadcrumbs', but now sounds weird and I will take a better look :).

Thx!

@sclaughl
Copy link
Author

Hello Felipe --

Thanks for the quick reply! I appreciate that you made this project available on github, and I noticed that it has been a while since you made changes to it. So don't worry too much about it. Mainly I just wanted to make sure I wasn't missing something obvious on my end.

Cheers!

--Stuart

@adam-iris
Copy link
Contributor

I came here investigating this same issue. I've seen behavior that I'm pretty sure is tied to the use of Singleton, although it's hard to reproduce. We are running Django via Apache/wsgi, and if multiple users are making requests at the same time, one of them may get nothing while the other gets a concatenation of both sets of breadcrumbs.

I noticed there is a fork at https://github.com/alepane21/django-breadcrumbs which appears to do nothing but remove the Singleton behavior -- I don't know the author or how it's been tested, but it seems like a simple enough change.

@chronossc
Copy link
Owner

Wil check that this weekend.

Someone have a idea how I can reproduce this kind of test in a unit or
integration test?

Felipe 'chronos' Prenholato.
Linux User nº 405489
Home page: http://devwithpassion.com | http://chronosbox.org/blog
GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc

2014-06-17 20:39 GMT-03:00 adam-iris [email protected]:

I came here investigating this same issue. I've seen behavior that I'm
pretty sure is tied to the use of Singleton, although it's hard to
reproduce. We are running Django via Apache/wsgi, and if multiple users are
making requests at the same time, one of them may get nothing while the
other gets a concatenation of both sets of breadcrumbs.

I noticed there is a fork at
https://github.com/alepane21/django-breadcrumbs which appears to do
nothing but remove the Singleton behavior -- I don't know the author or how
it's been tested, but it seems like a simple enough change.


Reply to this email directly or view it on GitHub
#12 (comment)
.

@bashu bashu self-assigned this Aug 10, 2015
@bashu bashu removed their assignment Sep 8, 2015
@skolsuper
Copy link

This issue makes this library impossible to use with django's CachedTemplateLoader:

https://docs.djangoproject.com/en/1.8/ref/templates/api/#django.template.loaders.cached.Loader

All of the built-in Django template tags are safe to use with the cached loader, but if you’re using custom template tags that come from third party packages, or that you wrote yourself, you should ensure that the Node implementation for each tag is thread-safe. For more information, see template tag thread safety considerations.

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 a pull request may close this issue.

5 participants