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

removed usage of singleton (it's not threadsafe!) #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions breadcrumbs/breadcrumbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,11 @@ def _drop_it(self):
Singleton.__instance__ = None


class Breadcrumbs(Singleton):
class Breadcrumbs(object):
"""
Breadcrumbs maintain a list of breadcrumbs that you can get interating with
class or with get_breadcrumbs().
"""
__bds = []
__autohome = getattr(settings, 'BREADCRUMBS_AUTO_HOME', False)
__urls = []
__started = False

def __call__(self, *args, **kwargs):
if not len(args) and not len(kwargs):
Expand Down Expand Up @@ -123,9 +119,7 @@ def __init__(self, *a, **kw):
Call validate and if ok, call fill bd
"""
super(Breadcrumbs, self).__init__(*a, **kw)
if not self.__started:
self._clean()
self.__started = True
self._clean()
if a or kw:
self._add(*a, **kw)

Expand Down
2 changes: 0 additions & 2 deletions breadcrumbs/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class BreadcrumbsMiddleware(object):

def process_request(self, request):
request.breadcrumbs = Breadcrumbs()
request.breadcrumbs._clean()


class FlatpageFallbackMiddleware(object):
def process_response(self, request, response):
Expand Down