Did I find the right examples for you? yes no

All Samples(7)  |  Call(5)  |  Derive(0)  |  Import(2)

src/p/o/popcorn_maker-HEAD/popcorn_gallery/popcorn/views/projects.py   popcorn_maker(Download)
from ..models import (Project, ProjectCategory, Template, TemplateCategory,
                      ProjectCategoryMembership)
from ..utils import update_views_count, get_order_fields, update_vote_score
from ...base.utils import notify_admins
 
def user_project_summary(request, project):
    update_views_count(project)
    user_vote = Vote.objects.get_for_user(project, request.user)
    votes = update_vote_score(project)
    context = {
def template_summary(request, template):
    """Summary of a ``Template`` agregates metadata for the template"""
    update_views_count(template)
    category_list = TemplateCategory.objects.filter(is_featured=True)
    project_list = Project.live.filter(template=template)[:5]

src/p/o/popcorn_maker-HEAD/popcorn_gallery/popcorn/tests/utils_tests.py   popcorn_maker(Download)
from dateutil.relativedelta import relativedelta
from nose.tools import eq_, ok_
from ..utils import (update_views_count, get_order_fields, update_vote_score,
                     get_valid_file_regex, import_zipped_template)
 
    def test_count_not_in_cache(self, cache_get, cache_set):
        self.item.modified = datetime.datetime.utcnow() - relativedelta(minutes=1)
        count = update_views_count(self.item)
        eq_(count, 1)
        eq_(self.item.save.called, False)
    def test_count_in_cache(self, cache_get, cache_set):
        self.item.modified = datetime.datetime.utcnow() - relativedelta(minutes=1)
        count = update_views_count(self.item)
        eq_(count, 2)
        eq_(self.item.save.called, False)
    def test_count_saved(self, cache_get, cache_set):
        self.item.modified = datetime.datetime.utcnow() - relativedelta(minutes=11)
        count = update_views_count(self.item)
        eq_(count, 2)
        eq_(self.item.save.called, True)