Edgewall Software

Ticket #7823: t7823-genshi_modpython-r8333-011.diff

File t7823-genshi_modpython-r8333-011.diff, 747 bytes (added by osimons, 3 years ago)

Only enter the workaround code if Genshi is actually installed as a zipped egg.

  • trac/web/__init__.py

    diff --git a/trac/web/__init__.py b/trac/web/__init__.py
    a b  
    33# PYTHON_EGG_CACHE variable is set from there 
    44# 
    55# TODO: Remove this once the Genshi zip_safe issue has been resolved. 
    6 try: 
    7     import mod_python.apache 
    8     import sys 
    9     if 'trac.web.modpython_frontend' in sys.modules: 
     6from pkg_resources import get_provider, ZipProvider 
     7if isinstance(get_provider('genshi'), ZipProvider): 
     8    try: 
     9        import mod_python.apache 
     10        import sys 
     11        if 'trac.web.modpython_frontend' in sys.modules: 
     12            from trac.web.api import * 
     13    except ImportError: 
    1014        from trac.web.api import * 
    11 except ImportError: 
     15else: 
    1216    from trac.web.api import * 
    13