コード例 #1
0
 def __before__(self, *args, **kwargs):
     if not request.settings['appearance_enable_user_uploads']:
         abort(404)
     result = BaseController.__before__(self, *args, **kwargs)
     # BareBonesController will set request.perm
     if not request.perm.contains_permission('upload'):
         abort(404)
     return result
コード例 #2
0
 def __call__(self, environ, start_response):
     """Invoke the Controller"""
     # BaseController.__call__ dispatches to the Controller method
     # the request is routed to. This routing information is
     # available in environ['pylons.routes_dict']
     request.identity = request.environ.get('repoze.who.identity')
     tmpl_context.identity = request.identity
     return BaseController.__call__(self, environ, start_response)
コード例 #3
0
 def __before__(self, *args, **kwargs):
     if not request.settings['appearance_enable_user_uploads']:
         abort(404)
     result = BaseController.__before__(self, *args, **kwargs)
     # BareBonesController will set request.perm
     if not request.perm.contains_permission('upload'):
         abort(404)
     return result
コード例 #4
0
ファイル: categories.py プロジェクト: vinces1979/mediacore
    def __before__(self, *args, **kwargs):
        """Load all our category data before each request."""
        BaseController.__before__(self, *args, **kwargs)

        c.categories = Category.query.order_by(Category.name).populated_tree()

        counts = dict(DBSession.query(Category.id, Category.media_count_published))
        c.category_counts = counts.copy()
        for cat, depth in c.categories.traverse():
            count = counts[cat.id]
            if count:
                for ancestor in cat.ancestors():
                    c.category_counts[ancestor.id] += count

        category_slug = request.environ["pylons.routes_dict"].get("slug", None)
        if category_slug:
            c.category = fetch_row(Category, slug=category_slug)
            c.breadcrumb = c.category.ancestors()
            c.breadcrumb.append(c.category)
コード例 #5
0
ファイル: categories.py プロジェクト: isaleem/cumin
    def __before__(self, *args, **kwargs):
        """Load all our category data before each request."""
        BaseController.__before__(self, *args, **kwargs)

        c.categories = Category.query\
            .order_by(Category.name)\
            .options(orm.undefer('media_count_published'))\
            .populated_tree()

        counts = dict((cat.id, cat.media_count_published)
                      for cat, depth in c.categories.traverse())
        c.category_counts = counts.copy()
        for cat, depth in c.categories.traverse():
            count = counts[cat.id]
            if count:
                for ancestor in cat.ancestors():
                    c.category_counts[ancestor.id] += count

        category_slug = request.environ['pylons.routes_dict'].get('slug', None)
        if category_slug:
            c.category = fetch_row(Category, slug=category_slug)
            c.breadcrumb = c.category.ancestors()
            c.breadcrumb.append(c.category)
コード例 #6
0
 def __before__(self, *args, **kwargs):
     if not request.settings['appearance_enable_user_uploads']:
         abort(404)
     return BaseController.__before__(self, *args, **kwargs)
コード例 #7
0
ファイル: upload.py プロジェクト: AshKash/mediacore-community
 def __before__(self, *args, **kwargs):
     if not request.settings['appearance_enable_user_uploads']:
         abort(404)
     return BaseController.__before__(self, *args, **kwargs)
コード例 #8
0
ファイル: settings.py プロジェクト: RadioErewan/mediacore
 def __before__(self, *args, **kwargs):
     """Load all our settings before each request."""
     BaseController.__before__(self, *args, **kwargs)
     c.settings = dict(DBSession.query(Setting.key, Setting))