Example #1
0
def retrieveView():
    #because the view registers itself as a site,
    #we can retrieve it...
    site = getSite()
    if not IKSSView.providedBy(site):
        raise LookupError(
            "You haven't initialized the KSS response yet, "
            "do so by calling startKSSCommands(context, request).")
    return site
def findSiteRoot():
    """Method to get the site root from the KSS
    site root.  MADNESS.
    """
    site_root = getSite()
    # If the KSS is in use, it has its own site root :(
    if HAS_KSS and IKSSView.providedBy(site_root):
        context = site_root.context
        request = site_root.request
        # get the portal via the plone util view
        portal_state = getMultiAdapter((context, request),
                                       name=u"plone_portal_state")
        site_root = portal_state.portal()
    return site_root