Пример #1
0
def release_language_feed(request, project_slug, release_slug, language_code,
    slug=None, param='', feed_dict=None,):
    param = '%s/%s/%s' % (project_slug, release_slug, language_code)
    if slug:
        url = "%s/%s" % (slug, param)
    else:
        url = param
    return feed(request, url, feed_dict)
Пример #2
0
def feed_for_user(request):
    """
    An atom feed for all unarchived :model:`notification.Notice`s for a user.
    """
    url = "feed/%s" % request.user.username
    return feed(request, url, {
        "feed": NoticeUserFeed,
    })
Пример #3
0
def feed_for_user(request):
    """
    An atom feed for all unarchived :model:`notification.Notice`s for a user.
    """
    url = "feed/%s" % request.user.username
    return feed(request, url, {
        "feed": NoticeUserFeed,
    })
Пример #4
0
def feeds(request, blog_slug, feed_item, **kwargs):

    from django.contrib.syndication.views import feed

    if "/" in feed_item:
        feed_type, slug = feed_item.split("/", 1)
    else:
        feed_type = feed_item
        slug = ""

    if "blog_root" in kwargs:
        del kwargs["blog_root"]

    if feed_type == "posts":
        return feed(request, url="posts/%s" % (blog_slug), **kwargs)
    elif feed_type == "tag":
        return feed(request, url="tag/%s/%s" % (blog_slug, feed_item), **kwargs)
    raise Http404
Пример #5
0
def release_feed(
    request,
    project_slug,
    release_slug,
    slug=None,
    param='',
    feed_dict=None,
):
    param = '%s/%s' % (project_slug, release_slug)
    if slug:
        url = "%s/%s" % (slug, param)
    else:
        url = param
    return feed(request, url, feed_dict)
Пример #6
0
def slug_feed(request, slug=None, param='', feed_dict=None):
    """
    Override default feed, using custom (including nonexistent) slug.

    Provides the functionality needed to decouple the Feed's slug from
    the urlconf, so a feed mounted at "^/feed" can exist.

    See also http://code.djangoproject.com/ticket/6969.
    """
    if slug:
        url = "%s/%s" % (slug, param)
    else:
        url = param
    return feed(request, url, feed_dict)
Пример #7
0
def blog_post_feed(request, format):
    """
    Blog posts feeds - handle difference between Django 1.3 and 1.4
    """
    blog_feed_dict = {"rss": PostsRSS, "atom": PostsAtom}
    try:
        blog_feed_dict[format]
    except KeyError:
        raise Http404()
    try:
        # Django <= 1.3
        from django.contrib.syndication.views import feed
    except ImportError:
        # Django >= 1.4
        return blog_feed_dict[format]()(request)
    else:
        return feed(request, format, feed_dict=blog_feed_dict)
Пример #8
0
def blog_post_feed(request, format):
    """
    Blog posts feeds - handle difference between Django 1.3 and 1.4
    """
    blog_feed_dict = {"rss": PostsRSS, "atom": PostsAtom}
    try:
        blog_feed_dict[format]
    except KeyError:
        raise Http404()
    try:
        # Django <= 1.3
        from django.contrib.syndication.views import feed
    except ImportError:
        # Django >= 1.4
        return blog_feed_dict[format]()(request)
    else:
        return feed(request, format, feed_dict=blog_feed_dict)
Пример #9
0
def rss_dispatcher(request, path_info, type_name):
	"""
	конфиглеты:
	rss_show ::= True|False, показывать ли на этой странице ленту сразу же
	rss_link ::= <url>, показывать по ссылке <.../RSS> ленту для этого объекта вместо текущего
	rss_type ::= CLASS_NAME, по умолчанию (в случае с rss_show) показывать опр. тип
	"""

	from django.contrib.syndication.views import feed

	from core.feeds import ObjectFeed
	request.rss_type_name = type_name

	page = get_object_by_url(path_info)
	path_info = page.config().get('rss_link',  path_info)
	request.config = page.config()

	return feed(request, url = "default/%s"%path_info, feed_dict = {'default': ObjectFeed} )
Пример #10
0
def rss_dispatcher(request, path_info, type_name):
    """
	конфиглеты:
	rss_show ::= True|False, показывать ли на этой странице ленту сразу же
	rss_link ::= <url>, показывать по ссылке <.../RSS> ленту для этого объекта вместо текущего
	rss_type ::= CLASS_NAME, по умолчанию (в случае с rss_show) показывать опр. тип
	"""

    from django.contrib.syndication.views import feed

    from core.feeds import ObjectFeed
    request.rss_type_name = type_name

    page = get_object_by_url(path_info)
    path_info = page.config().get('rss_link', path_info)
    request.config = page.config()

    return feed(request,
                url="default/%s" % path_info,
                feed_dict={'default': ObjectFeed})
Пример #11
0
def blog_post_feed(request, format, **kwargs):
    """
    Blog posts feeds - handle difference between Django 1.3 and 1.4
    """
    blog_feed_dict = {"rss": PostsRSS, "atom": PostsAtom}
    try:
        blog_feed_dict[format]
    except KeyError:
        raise Http404()
    try:
        # Django <= 1.3
        from django.contrib.syndication.views import feed
    except ImportError:
        # Django >= 1.4
        return blog_feed_dict[format](**kwargs)(request)
    else:
        if len(kwargs) == 1:
            # /author/foo/ or /tag/bar/ or /category/baz/
            # gets extracted in get_feed method of feed class.
            format += "/%s/%s" % kwargs.items()[0]
        return feed(request, format, feed_dict=blog_feed_dict)
Пример #12
0
def collection(request, url):
    if not url.endswith('/') and settings.APPEND_SLASH:
        return HttpResponseRedirect("%s/" % request.path)
    if not url.startswith('/'):
        url = "/" + url
    
    is_feed = False
    if url.endswith('/feed/'):
        is_feed = True
        url = url[:url.rfind('feed')]

    if not is_feed:
        collection = get_object_or_404(Collection, url=url, sites=Site.objects.get_current())
        t = loader.select_template((
            collection.template_name,
            'news/collections/%s.html' % '_'.join(collection.url.strip('/').split('/')),
            'news/collections/default.html'))
        c = RequestContext(request, {'collection': collection})
        return HttpResponse(t.render(c))
    else:
        return feed(request, url, {'': CollectionFeed})
Пример #13
0
def blog_post_feed(request, format, **kwargs):
    """
    Blog posts feeds - handle difference between Django 1.3 and 1.4
    """
    blog_feed_dict = {"rss": PostsRSS, "atom": PostsAtom}
    try:
        blog_feed_dict[format]
    except KeyError:
        raise Http404()
    try:
        # Django <= 1.3
        from django.contrib.syndication.views import feed
    except ImportError:
        # Django >= 1.4
        return blog_feed_dict[format](**kwargs)(request)
    else:
        if len(kwargs) == 1:
            # /author/foo/ or /tag/bar/ or /category/baz/
            # gets extracted in get_feed method of feed class.
            format += "/%s/%s" % kwargs.items()[0]
        return feed(request, format, feed_dict=blog_feed_dict)
Пример #14
0
def feed_for_user(request):
    url = "feed/%s" % request.user.username
    return feed(request, url, {
        "feed": TxNoticeUserFeed,
    })
Пример #15
0
        def call(*cargs, **ckw):
            from django.contrib.syndication.views import feed

            request = cargs[1]
            data = fn(*cargs, **ckw)
            return feed(request, **data)
Пример #16
0
 def feed(self, request, url):
     return feed(request, url, self.feeds)
Пример #17
0
 def call(*cargs, **ckw):
     from django.contrib.syndication.views import feed
     request = cargs[1]
     data = fn(*cargs, **ckw)
     return feed(request, **data)
Пример #18
0
 def feed(self, request, url):
     return feed(request, url, self.feeds)
Пример #19
0
def feed_all(request):
    url = "feed/"
    return feed(request, url, {
        "feed": DelegateFeed,
    })
Пример #20
0
def feed_for_user(request):
    url = "feed/%s" % request.user.username
    return feed(request, url, {
        "feed": NoticeUserFeed,
    })
Пример #21
0
def feed_all(request):
    url = 'feed/'
    return feed(request, url, {
        "feed": AllBlogFeed,
    })
Пример #22
0
 def basic_auth_feed(request, url, feed_dict=None):
     return feed(request, url, feed_dict)
Пример #23
0
def context_feed_for_user(request, context, object_id):
    url = "%s/%s/feed/%s" % (context, object_id, request.user.username)
    return feed(request, url, {
        "feed": ContextNoticeFeed,
    })
Пример #24
0
def feed_all(request):
    url = "feed/"
    return feed(request, url, {
            "feed": TalkFeed,
            })
Пример #25
0
def feed_user(request, username):
    url = 'feed/%s' %username
    return feed(request, url, {
        "feed": BlogUserFeed,
    })
Пример #26
0
def feed_all(request):
    url = "feed/"
    return feed(request, url, {
            "feed": DelegateFeed,
            })
Пример #27
0
def protected_feed(*args, **kwargs):
	return feed(*args, **kwargs)
Пример #28
0
def proj_feed(request, url, feed_dict=None):
    slug, param = url.split('/', 1)
    project_name = param
    project = get_project(request, project_name)
    return feed(request, url, feed_dict)
Пример #29
0
def feed_all(request):
    url = 'feed/'
    return feed(request, url, {
        "feed": AllBlogFeed,
    })
Пример #30
0
def slug_feed(request, slug=None, param='', feed_dict=None):
    if slug:
        url = "%s/%s" % (slug, param)
    else:
        url = param
    return feed(request, url, feed_dict)
Пример #31
0
def feed_user(request, username):
    url = 'feed/%s' % username
    return feed(request, url, {
        "feed": BlogUserFeed,
    })
Пример #32
0
def feed_all(request):
    url = "feed/"
    return feed(request, url, {
        "feed": TalkFeed,
    })