Permalink
Browse files

fixes #247 problem with preview, breadcrumbs on first page

  • Loading branch information...
digi604 committed Nov 17, 2009
1 parent 3b32886 commit 816af68d6d412ac692735145fc3be1d9500f4ad6
Showing with 7 additions and 3 deletions.
  1. +7 −3 cms/templatetags/cms_tags.py
@@ -357,15 +357,19 @@ def show_breadcrumb(context, start_level=0, template="cms/breadcrumb.html"):
def ancestors_from_page(page, page_queryset, title_queryset, lang):
ancestors = list(page.get_cached_ancestors(False))
ancestors.append(page)
- home = page_queryset.get_home()
- if ancestors and ancestors[0].pk != home.pk:
+ try:
+ home = page_queryset.get_home()
+ except NoHomeFound:
+ home = None
+ if ancestors and home and ancestors[0].pk != home.pk:
ancestors = [home] + ancestors
ids = [page.pk]
for anc in ancestors:
ids.append(anc.pk)
titles = title_queryset.filter(page__in=ids, language=lang)
for anc in ancestors:
- anc.home_pk_cache = home.pk
+ if home:
+ anc.home_pk_cache = home.pk
for title in titles:
if title.page_id == anc.pk:
if not hasattr(anc, "title_cache"):

0 comments on commit 816af68

Please sign in to comment.