[Zope3-checkins] CVS: Zope3/src/zope/modulealias -
__init__.py:1.1.2.1 meta.zcml:1.1.2.1
metaconfigure.py:1.1.2.1 metadirectives.py:1.1.2.1
Chris McDonough
chrism at plope.com
Wed Jan 14 09:59:13 EST 2004
Update of /cvs-repository/Zope3/src/zope/modulealias
In directory cvs.zope.org:/tmp/cvs-serv21541/modulealias
Added Files:
Tag: steveachrismcd-securitypolicy-branch
__init__.py meta.zcml metaconfigure.py metadirectives.py
Log Message:
Move modulealiases to zope package out of zope.products and include it via zope.app.meta.czml.
=== Added File Zope3/src/zope/modulealias/__init__.py ===
# Make a package
=== Added File Zope3/src/zope/modulealias/meta.zcml ===
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta">
<meta:directive
namespace="http://namespaces.zope.org/zope"
name="modulealias"
schema=".metadirectives.IModuleAliasDirective"
handler=".metaconfigure.defineModuleAlias" />
</configure>
=== Added File Zope3/src/zope/modulealias/metaconfigure.py ===
##############################################################################
#
# Copyright (c) 2004 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.
#
##############################################################################
"""
modulealiases package allows you to make module alias declarations via zcml,
e.g.:
<modulealias source="some.nonexistent.package" target="some.existing.package"/>
$Id: metaconfigure.py,v 1.1.2.1 2004/01/14 14:59:12 chrism Exp $
"""
import sys
def defineModuleAlias(_context, source, target):
_context.action(
discriminator = None,
callable = _defineModuleAlias,
args = (source, target),
)
def _defineModuleAlias(source, target):
""" define a module alias by munging sys.modules """
if not sys.modules.has_key(source):
if sys.modules.has_key(target):
sys.modules[source] = sys.modules[target]
=== Added File Zope3/src/zope/modulealias/metadirectives.py ===
##############################################################################
#
# Copyright (c) 2004 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.
#
##############################################################################
from zope.configuration.fields import PythonIdentifier
from zope.interface import Interface
class IModuleAliasDirective(Interface):
""" Define a new module alias """
source = PythonIdentifier()
target = PythonIdentifier()
More information about the Zope3-Checkins
mailing list