Ejemplo n.º 1
0
def _mainview(request, view_data, **criterias):
	response, site, cachekey = view_data
	if not response:
		ctx = fjlib.page_context(request, site, **criterias)
		response = render_to_response(
			u'feedjack/{0}/post_list.html'.format(site.template),
			ctx, context_instance=RequestContext(request) )
		# per host caching, in case the cache middleware is enabled
		patch_vary_headers(response, ['Host'])
		if site.use_internal_cache:
			fjcache.cache_set( site, cachekey,
				(response, ctx_get(ctx, 'last_modified')) )
	else: response = response[0]
	return response
Ejemplo n.º 2
0
def _mainview(request, view_data, **criterias):
    response, site, cachekey = view_data
    if not response:
        ctx = fjlib.page_context(request, site, **criterias)
        response = render_to_response(u'feedjack/{0}/post_list.html'.format(
            site.template),
                                      ctx,
                                      context_instance=RequestContext(request))
        # per host caching, in case the cache middleware is enabled
        patch_vary_headers(response, ['Host'])
        if site.use_internal_cache:
            fjcache.cache_set(site, cachekey,
                              (response, ctx_get(ctx, 'last_modified')))
    else:
        response = response[0]
    return response
Ejemplo n.º 3
0
def mainview(request, tag=None, subscription=None, group=None, newer=None, asc=None):
    """ View that handles all page requests.
    """

    response, site, cachekey, sfeeds_obj, sfeeds_ids = initview(request)
    if response:
        return response

    ctx = RequestContext(request, fjlib.page_context(request, site, tag, subscription, group, newer, asc, (sfeeds_obj, \
      sfeeds_ids)))

    response = render_to_response('feedjack/post_list.html', ctx)
    
    # per host caching, in case the cache middleware is enabled
    patch_vary_headers(response, ['Host'])

    if site.use_internal_cache:
        fjcache.cache_set(site, cachekey, response)
    return response
Ejemplo n.º 4
0
def mainview(request, tag=None, user=None):
    """ View that handles all page requests.
    """

    response, site, cachekey, sfeeds_obj, sfeeds_ids = initview(request)
    if response:
        return response

    ctx = fjlib.page_context(request, site, tag, user, (sfeeds_obj, \
      sfeeds_ids))

    response = render_to_response('feedjack/%s/post_list.html' % \
      (site.template), ctx, context_instance=RequestContext(request))
    
    # per host caching, in case the cache middleware is enabled
    patch_vary_headers(response, ['Host'])

    if site.use_internal_cache:
        fjcache.cache_set(site, cachekey, response)
    return response
Ejemplo n.º 5
0
def mainview(request, tag=None, user=None):
    """ View that handles all page requests.
    """

    response, site, cachekey, sfeeds_obj, sfeeds_ids = initview(request)
    if response:
        return response

    ctx = fjlib.page_context(request, site, tag, user, (sfeeds_obj, \
      sfeeds_ids))

    response = render_to_response('feedjack/%s/post_list.html' % \
      (site.template), ctx)

    # per host caching, in case the cache middleware is enabled
    patch_vary_headers(response, ['Host'])

    if site.use_internal_cache:
        fjcache.cache_set(site, cachekey, response)
    return response
Ejemplo n.º 6
0
def mainview(request, **criterias):
	'View that handles all page requests.'
	response, site, cachekey = initview(request)

	if not response:
		ctx = fjlib.page_context(request, site, **criterias)
		response = render_to_response(
			u'feedjack/{0}/post_list.html'.format(site.template),
			ctx, context_instance=RequestContext(request) )
		# per host caching, in case the cache middleware is enabled
		patch_vary_headers(response, ['Host'])
		if site.use_internal_cache:
			fjcache.cache_set(
				site, cachekey, (response, ctx['last_modified']) )
	else: response = response[0]

	fj_track_header = request.META.get('HTTP_X_FEEDJACK_TRACKING')\
		or request.COOKIES.get('feedjack.tracking')
	if fj_track_header:
		response['X-Feedjack-Tracking'] = fj_track_header
		response.set_cookie('feedjack.tracking', fj_track_header)

	return response
Ejemplo n.º 7
0
def mainview(request,
             tag=None,
             subscription=None,
             group=None,
             newer=None,
             asc=None):
    """ View that handles all page requests.
    """

    response, site, cachekey, sfeeds_obj, sfeeds_ids = initview(request)
    if response:
        return response

    ctx = RequestContext(request, fjlib.page_context(request, site, tag, subscription, group, newer, asc, (sfeeds_obj, \
      sfeeds_ids)))

    response = render_to_response('feedjack/post_list.html', ctx)

    # per host caching, in case the cache middleware is enabled
    patch_vary_headers(response, ['Host'])

    if site.use_internal_cache:
        fjcache.cache_set(site, cachekey, response)
    return response
Ejemplo n.º 8
0
def mainview(request, tag=None, user=None):
    """ View that handles all page requests.
    """

    response, site, cachekey, sfeeds_obj, sfeeds_ids = initview(request)
    if response:
        return response

    ctx = fjlib.page_context(request, site, tag, user, (sfeeds_obj, \
      sfeeds_ids))

    # we need a request context to apply the context template
    # processors (i.e. static files)
    # ctx = RequestContext(request, ctx)

    response = render(request, 'feedjack/%s/post_list.html' % site.template,
                      ctx)

    # per host caching, in case the cache middleware is enabled
    patch_vary_headers(response, ['Host'])

    if site.use_internal_cache:
        fjcache.cache_set(site, cachekey, response)
    return response