[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Formulator - metaConfigure.py:1.1.2.1

Stephan Richter srichter@cbu.edu
Fri, 1 Mar 2002 02:46:59 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Formulator
In directory cvs.zope.org:/tmp/cvs-serv7801

Added Files:
      Tag: srichter-OFS_Formulator-branch
	metaConfigure.py 
Log Message:
- Implemented metaConfigure, in order to handle ZCML correctly.



=== Added File Zope3/lib/python/Zope/App/Formulator/metaConfigure.py ===
##############################################################################
#
# Copyright (c) 2001, 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
# 
##############################################################################
"""

$Id: metaConfigure.py,v 1.1.2.1 2002/03/01 07:46:57 srichter Exp $
"""

from Zope.Configuration.name import resolve
from Zope.Configuration.Action import Action
from FieldRegistry import registerField
from ValidatorRegistry import registerValidator

def field(name, field):
    """
    Note that most applications return an actual Action at this point;
    however, the field registry is requred during the startup, so we
    need to initialize it now.
    """
    field = resolve(field)
    registerField(name, field)
    return []


def validator(name, validator):
    """
    Note that most applications return an actual Action at this point;
    however, the validator registry is requred during the startup, so we
    need to initialize it now.
    """
    validator = resolve(validator)
    registerValidator(name, validator)
    return []