from django.template import loader, RequestContext
from django.shortcuts import get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.core.xheaders import populate_xheaders
from django.utils.safestring import mark_safe
from s7n.pages.models import Page

DEFAULT_TEMPLATE = 'pages/default.html'

def page(request, url):
    if not url.endswith('/') and settings.APPEND_SLASH:
        return HttpResponseRedirect("%s/" % request.path)
    if not url.startswith('/'):
        url = "/" + url
    f = get_object_or_404(Page, url__exact=url, site_id=settings.SITE_ID)
    return render_flatpage(request, f)

def render_flatpage(request, f):
    t = loader.get_template(DEFAULT_TEMPLATE)

    # To avoid having to always use the "|safe" filter in flatpage templates,
    # mark the title and content as already safe (since they are raw HTML
    # content in the first place).
    f.name = mark_safe(f.name)
    f.content_html = mark_safe(f.content_html)

    c = RequestContext(request, {
        'page': f,
    })
    response = HttpResponse(t.render(c))
    populate_xheaders(request, response, Page, f.id)
    return response

@@ -606,28 +606,21 @@
 site
-_id=settings.SITE_ID
+=request.site
 )%0A  

use the new request.site object