chronossc / django-breadcrumbs

Easy to use generic breadcrumbs system for Django framework.
http://code.google.com/p/django-breadcrumbs/
Other
105 stars 29 forks source link

Why is Breadcrumbs a Singleton? #12

Open sclaughl opened 11 years ago

sclaughl commented 11 years ago

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 commented 11 years ago

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 commented 11 years ago

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 commented 10 years ago

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 commented 10 years ago

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 notifications@github.com:

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 https://github.com/chronossc/django-breadcrumbs/issues/12#issuecomment-46379786 .

skolsuper commented 8 years ago

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.