Пример #1
0
    def get(request):
        """
        static method for get
        """

        # redirect active session
        if SessionHandler.isUserSessionAlive(request.session):
            loginUser = SessionHandler.getSessionUser(request.session)

            if "fid" in request.GET.keys() and "eid" in request.GET.keys():
                fid = request.GET["fid"]
                eid = request.GET["eid"]
                feeds = DatabaseProvider.getFeedsByUserId(loginUser.id)  # gets the feeds of the user
                feed = DatabaseProvider.getFeedByUserIdAndFeedId(loginUser.id, fid)  # gets a feed of the user
                pFeed = ParsedFeed(feed)

                entry = []
                for e in pFeed.entries:
                    if e.id == eid:
                        entry.append(e)
                        break

                return render_to_response(
                    "displayfeedentry.html",
                    {"feeds": feeds, "feed": pFeed, "entry": entry[0], "user": loginUser},
                    context_instance=RequestContext(request),
                )

        return HttpResponseRedirect("/feedreader/")
Пример #2
0
    def get(request):
        """
        static method for get
        """

        # redirect active session
        if SessionHandler.isUserSessionAlive(request.session):
            loginUser = SessionHandler.getSessionUser(request.session)

            if 'info' in request.GET.keys() and 'fid' in request.GET.keys():
                if request.GET['info'] == 'show':
                    feeds = DatabaseProvider.getFeedsByUserId(loginUser.id)  # gets the feeds of the user
                    feed = DatabaseProvider.getFeedByUserIdAndFeedId(loginUser.id, request.GET['fid'])  # gets the feed with the id of the user
                    pFeed = ParsedFeed(feed)
                    return render_to_response('displayfeedinfo.html', {'feedinfo': pFeed, 'feeds': feeds, 'user': loginUser}, context_instance=RequestContext(request))

        return HttpResponseRedirect('/feedreader/')
Пример #3
0
    def get(request):
        """
        static method for get
        """

        # redirect active session
        if SessionHandler.isUserSessionAlive(request.session):
            loginUser = SessionHandler.getSessionUser(request.session)

            if 'fid' in request.GET.keys():
                feedId = request.GET['fid']
                feed = DatabaseProvider.getFeedByUserIdAndFeedId(loginUser.id, feedId)  # gets the specific feed of the user
                parsedFeed = ParsedFeed(feed)

                feeds = DatabaseProvider.getFeedsByUserId(loginUser.id)  # gets all feeds of a user

                return render_to_response('displayfeed.html', {'feed': parsedFeed, 'feeds': feeds, 'user': loginUser}, context_instance=RequestContext(request))


        return HttpResponseRedirect('/feedreader/')