Changeset 3615

Show
Ignore:
Timestamp:
05/06/08 02:52:53 (5 months ago)
Author:
coderanger
Message:

Escape include text. New README.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • includemacro/0.11/includemacro/macros.py

    r3606 r3615  
    11# TracIncludeMacro macros 
     2import urllib2 
     3from StringIO import StringIO 
     4 
    25from trac.core import * 
    36from trac.wiki.macros import WikiMacroBase 
     
    69from trac.mimeview.api import Mimeview, get_mimetype, Context 
    710from trac.perm import IPermissionRequestor 
    8  
    9 import urllib2 
     11from genshi.core import escape 
     12from genshi.input import HTMLParser, ParseError 
     13from genshi.filters.html import HTMLSanitizer 
    1014 
    1115__all__ = ['IncludeMacro'] 
     
    8791        if dest_format: 
    8892            out = Mimeview(self.env).render(ctxt, dest_format, out) 
     93         
     94        # Escape if needed 
     95        if not self.config.getbool('wiki', 'render_unsafe_content', False): 
     96            try: 
     97                out = HTMLParser(StringIO(out)).parse() | HTMLSanitizer() 
     98            except ParseError: 
     99                out = escape(out) 
     100         
    89101        return out 
    90102             
  • includemacro/0.11/setup.py

    r3606 r3615  
    11#!/usr/bin/env python 
    22# -*- coding: iso-8859-1 -*- 
     3import os.path 
    34 
    45from setuptools import setup 
     
    67setup( 
    78    name = 'TracIncludeMacro', 
    8     version = '2.0.1', 
     9    version = '2.1', 
    910    packages = ['includemacro'], 
    1011 
     
    1213    author_email = 'noah@coderanger.net', 
    1314    description = 'Include the contents of external URLs and other Trac objects in a wiki page.', 
     15    long_description = open(os.path.join(os.path.dirname(__file__), 'README')).read(), 
    1416    license = 'BSD', 
    15     keywords = 'trac plugin wiki include macro', 
     17    keywords = 'trac 0.11 plugin wiki include macro', 
    1618    url = 'http://trac-hacks.org/wiki/IncludeMacro', 
    1719    classifiers = [