[Zope3-checkins] CVS: Zope3/src/zope/products/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 02:25:57 EST 2004


Update of /cvs-repository/Zope3/src/zope/products/modulealias
In directory cvs.zope.org:/tmp/cvs-serv7694

Added Files:
      Tag: steveachrismcd-securitypolicy-branch
	__init__.py meta.zcml metaconfigure.py metadirectives.py 
Log Message:
Small product to manage module aliases via ZCML.  I'm not sure where to put this, so for now I'm making it a product.


=== Added File Zope3/src/zope/products/modulealias/__init__.py ===
# Make a package


=== Added File Zope3/src/zope/products/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="module_alias"
      schema=".metadirectives.IModuleAliasDirective"
      handler=".metaconfigure.defineModuleAlias" />

</configure>


=== Added File Zope3/src/zope/products/modulealias/metaconfigure.py ===
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/products/modulealias/metadirectives.py ===
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