[Zope3-checkins] CVS: Zope3/src/zope/app/tests - ztapi.py:1.1.2.1

Jim Fulton cvs-admin at zope.org
Mon Nov 10 10:00:43 EST 2003


Update of /cvs-repository/Zope3/src/zope/app/tests
In directory cvs.zope.org:/tmp/cvs-serv19095/src/zope/app/tests

Added Files:
      Tag: adaptergeddon-branch
	ztapi.py 
Log Message:
Oops, forgot to add these files when I created the global presentation
service.


=== Added File Zope3/src/zope/app/tests/ztapi.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Testing helper functions

$Id: ztapi.py,v 1.1.2.1 2003/11/10 15:00:42 jim Exp $
"""
from zope.app import zapi
import zope.interface
from zope.component.servicenames import Presentation
from zope.publisher.browser import IBrowserRequest

def browserView(for_, name, factory, layer='default'):
    """Define a global browser view
    """
    s = zapi.getService(None, Presentation)
    return s.provideView(for_, name, IBrowserRequest, factory, layer)

def browserResource(name, factory, layer='default'):
    """Define a global browser view
    """
    s = zapi.getService(None, Presentation)
    return s.provideResource(name, IBrowserRequest, factory, layer)
    

def setDefaultViewName(for_, name, layer='default'):
    s = zapi.getService(None, Presentation)
    s.setDefaultViewName(for_, IBrowserRequest, name, layer=layer)
    




More information about the Zope3-Checkins mailing list