Ejemplo n.º 1
0
    def setUp(self):
        from ella.core.models import Author

        super(TestAuthorLH, self).setUp()

        try:
            import redis as redis_client
        except ImportError:
            raise SkipTest()

        self.redis = redis_client.Redis(**settings.TEST_CORE_REDIS)

        redis.client = self.redis
        redis.connect_signals()

        create_basic_categories(self)
        create_and_place_more_publishables(self)

        self.author = Author.objects.create(slug='testauthor')

        settings.LISTING_HANDLERS[DEFAULT_REDIS_HANDLER] = 'ella.core.cache.redis.AuthorListingHandler'

        for p in self.publishables:
            p.authors = [self.author]
            p.save()
Ejemplo n.º 2
0
    def setUp(self):
        from ella.core.models import Author

        super(TestAuthorLH, self).setUp()

        try:
            import redis as redis_client
        except ImportError:
            raise SkipTest()

        self.redis = redis_client.Redis(**settings.TEST_CORE_REDIS)

        redis.client = self.redis
        redis.connect_signals()

        create_basic_categories(self)
        create_and_place_more_publishables(self)

        self.author = Author.objects.create(slug='testauthor')

        settings.LISTING_HANDLERS[
            DEFAULT_REDIS_HANDLER] = 'ella.core.cache.redis.AuthorListingHandler'

        for p in self.publishables:
            p.authors = [self.author]
            p.save()
Ejemplo n.º 3
0
    def setUp(self):
        super(TestRedisListings, self).setUp()
        try:
            import redis as redis_client
        except ImportError:
            raise SkipTest()

        self.redis = redis_client.Redis(**settings.TEST_CORE_REDIS)

        redis.client = self.redis
        redis.connect_signals()

        create_basic_categories(self)
        create_and_place_more_publishables(self)
Ejemplo n.º 4
0
    def setUp(self):
        super(TestRedisListings, self).setUp()
        try:
            import redis as redis_client
        except ImportError:
            raise SkipTest()

        self.redis = redis_client.Redis(**settings.TEST_CORE_REDIS)

        redis.client = self.redis
        redis.connect_signals()

        create_basic_categories(self)
        create_and_place_more_publishables(self)
Ejemplo n.º 5
0
        if page_no > paginator.num_pages or page_no < 1:
            raise Http404(_('Invalid page number %r') % page_no)

        return paginator.page(page_no)

    @property
    def child_behavior(self):
        if self.child_listings is None:
            return ListingHandler.ALL if self._instance.tree_parent_id else ListingHandler.NONE
        return self.child_listings

app_registry.register('ella', EllaAppDataContainer, Category)


# connect redis listing handler signals
connect_signals()

# connect cache invalidation signals
connect_invalidation_signals()

try:
    # django < 1.9
    from django.template.base import add_to_builtins
except ImportError:
    pass
else:
    # add core templatetags to builtin so that you don't have to invoke {% load core %} in every template
    add_to_builtins('ella.core.templatetags.core')
    # keep this here for backwards compatibility
    add_to_builtins('ella.core.templatetags.related')
    # and custom urls
Ejemplo n.º 6
0
        if page_no > paginator.num_pages or page_no < 1:
            raise Http404(_('Invalid page number %r') % page_no)

        return paginator.page(page_no)

    @property
    def child_behavior(self):
        if self.child_listings is None:
            return ListingHandler.ALL if self._instance.tree_parent_id else ListingHandler.NONE
        return self.child_listings


app_registry.register('ella', EllaAppDataContainer, Category)

# connect redis listing handler signals
connect_signals()

# connect cache invalidation signals
connect_invalidation_signals()

# add core templatetags to builtin so that you don't have to invoke {% load core %} in every template
template.add_to_builtins('ella.core.templatetags.core')
# keep this here for backwards compatibility
template.add_to_builtins('ella.core.templatetags.related')
# and custom urls
template.add_to_builtins('ella.core.templatetags.custom_urls_tags')
# and the same for i18n
template.add_to_builtins('django.templatetags.i18n')
# and photos are always useful
template.add_to_builtins('ella.photos.templatetags.photos')