示例#1
0
文件: views.py 项目: berrueta/steamy
def news(request, source):
    if request.method == 'GET':
        finder = FeedFinder()
        try:
            feeds = finder.populate_feeds(source)
        except (SPARQLQueryProcessorError, SPARQLQueryBuilderError), e:
            return render_to_response('debian/error.html', {'reason': e})

        replydata = {'source': source, 'feeds': feeds}
        return render_to_response('debian/news.html', replydata)
示例#2
0
文件: views.py 项目: berrueta/steamy
            processor.execute_sanitized_query(query)
        except SPARQLQueryProcessorError, e:
            return render_to_response('debian/error.html', {'reason': e})

        if builder.source_search():
            results = processor.format_source_results()
        elif builder.binary_search():
            results = processor.format_binary_results()
        else:
            raise UnexpectedSituationError()

        sourcenames = [x.sourcename for x in results]
        if builder.binary_search():
            sourcenames = remove_duplicates(sourcenames, lambda x: x)

        finder = FeedFinder()
        aggregated_feeds = []
        for sourcename in sourcenames:
            aggregated_feeds.extend(finder.populate_feeds(sourcename))

        replydata = {'source': '', 'feeds': aggregated_feeds}
        return render_to_response('debian/news.html', replydata)
    else:
        return HttpResponse("405 - Method not allowed", status=405)


def source_detail(request, source, version):
    if request.method == 'GET':
        builder = SPARQLQueryBuilder()
        try:
            query = builder.create_binaries_query(source, version)
示例#3
0
 def setUp(self):
     self.finder = FeedFinder()
     self.mox = Mox()
     debian.services.RES_BASEURI = "base"