[Zope3-checkins] CVS: Zope3/src/zope/app/adapter/browser -
__init__.py:1.1 configure.zcml:1.1
Jim Fulton
jim at zope.com
Mon Mar 8 14:40:27 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/adapter/browser
In directory cvs.zope.org:/tmp/cvs-serv28862/src/zope/app/adapter/browser
Added Files:
__init__.py configure.zcml
Log Message:
Moved the adapter and presentation services from zope.app.services to
their own packages under zope.app. Also folded
zope.app.services.surrogate into the new adapter module,
zope.app.adapter.adapter.
=== Added File Zope3/src/zope/app/adapter/browser/__init__.py ===
##############################################################################
#
# Copyright (c) 2002 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.
#
##############################################################################
"""Views for local adapter registration.
AdapterSeviceView -- it's a bit different from other services, as it
has a lot of things in it, so we provide a search interface:
search page
browsing page
AdapterRegistrationAdd
$Id: __init__.py,v 1.1 2004/03/08 19:40:25 jim Exp $
"""
__metaclass__ = type
from zope.app.form.utility import setUpWidgets, getWidgetsData
from zope.schema import getFieldNamesInOrder
from zope.publisher.browser import BrowserView
from zope.app.adapter.adapter import IAdapterRegistration
from zope.app.interfaces.services.registration import IRegistration
from zope.app.interfaces.form import IInputWidget
from zope.app.form.utility import applyWidgetsChanges
from zope.app.event import publish
from zope.app.event.objectevent import ObjectCreatedEvent
from zope.app.adapter.adapter import AdapterRegistration
class AdapterRegistrationAdd(BrowserView):
def __init__(self, *args):
super(AdapterRegistrationAdd, self).__init__(*args)
setUpWidgets(self, IAdapterRegistration, IInputWidget)
def refresh(self):
if "FINISH" in self.request:
data = getWidgetsData(self, IAdapterRegistration)
registration = AdapterRegistration(**data)
publish(self.context.context, ObjectCreatedEvent(registration))
registration = self.context.add(registration)
applyWidgetsChanges(view, IRegistration, target=registration)
self.request.response.redirect(self.context.nextURL())
return False
return True
def getWidgets(self):
return ([getattr(self, name)
for name in getFieldNamesInOrder(IAdapterRegistration)]
+
[getattr(self, name)
for name in getFieldNamesInOrder(IRegistration)]
)
=== Added File Zope3/src/zope/app/adapter/browser/configure.zcml ===
<zope:configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns="http://namespaces.zope.org/browser"
i18n_domain="zope"
>
<addMenuItem
class="..adapter.LocalAdapterService"
title="Adapter Service"
description="Allows the registration of Adapters in this site"
permission="zope.ManageServices"
/>
<editform
schema="..adapter.IAdapterRegistration"
name="index.html"
menu="zmi_views"
label="Change adapter"
permission="zope.ManageServices"
/>
<addform
schema="..adapter.IAdapterRegistration"
name="AdapterRegistration"
content_factory="..adapter.AdapterRegistration"
arguments="provided factoryName"
keyword_arguments="required name permission"
label="Register an adapter"
permission="zope.ManageServices"
fields="required provided name permission factoryName"
menu="add_registration" title="Adapter Registration"
/>
</zope:configure>
More information about the Zope3-Checkins
mailing list