Ejemplo n.º 1
0
def test_lazy_title(template_context):

    from sitetree.sitetreeapp import LazyTitle, get_sitetree

    assert LazyTitle('one') == 'one'

    title = LazyTitle('here{% no_way %}there')

    get_sitetree().current_page_context = template_context()

    assert title == 'herethere'
Ejemplo n.º 2
0
def test_lazy_title(template_context):

    from sitetree.sitetreeapp import LazyTitle, get_sitetree

    assert LazyTitle('one') == 'one'

    title = LazyTitle('here{% no_way %}there')

    get_sitetree().current_page_context = template_context()

    assert title == 'herethere'
Ejemplo n.º 3
0
def test_customized_tree_handler(template_context):

    from sitetree.sitetreeapp import get_sitetree

    assert get_sitetree().customized  # see MySiteTree
Ejemplo n.º 4
0
 def current_sitetree(self, context):
     sitetree = get_sitetree()
     # noinspection PyUnresolvedReferences
     context['request'] = self.request
     sitetree.init_tree(self.sitetree, context)
     return sitetree.get_tree_current_item(self.sitetree)
Ejemplo n.º 5
0
from django.core.urlresolvers import reverse, NoReverseMatch
from django.contrib.sitemaps import Sitemap
from sitetree.models import TreeItem
from sitetree.sitetreeapp import get_sitetree


sitetree = get_sitetree()


class TreeItemSitemap(Sitemap):
    changefreq = 'weekly'
    priority = 0.8

    def items(self):
        return TreeItem.objects.filter(inmenu=True,).exclude(url__istartswith='http')

    def location(self, obj):
        try:
            url = reverse(obj.url)
        except NoReverseMatch:
            url = obj.url

        return url