Changeset 52692

Show
Ignore:
Timestamp:
03/20/08 12:41:53 (2 years ago)
Author:
madarche
Message:

Fixed #1898: IllegalHTML exception blocking HTML rendering and indexing.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Zope2/PortalTransforms/trunk/CHANGES

    r52086 r52692  
    77Bug fixes 
    88~~~~~~~~~ 
    9 - 
     9- #1898: IllegalHTML exception blocking HTML rendering and indexing. 
    1010New internal features 
    1111~~~~~~~~~~~~~~~~~~~~~ 
  • Zope2/PortalTransforms/trunk/libtransforms/utils.py

    r51799 r52692  
    11# $Id$ 
    22 
     3from logging import getLogger 
     4import re 
    35import os 
    46import sys 
    57from os.path import basename, splitext, join 
     8from cStringIO import StringIO 
    69from sgmllib import SGMLParser 
    7 from cStringIO import StringIO 
    8 import re 
     10 
     11LOG_KEY = 'PortalTransforms.libtransforms.utils' 
     12logger = getLogger(LOG_KEY) 
    913 
    1014HAVE_LXML = 0 
     
    128132             } 
    129133 
    130 class IllegalHTML( ValueError ): 
    131     pass 
    132  
    133134class StrippingParser( SGMLParser ): 
    134135    """ Pass only allowed tags;  raise exception for known-bad.  """ 
     
    171172 
    172173                if k.lower().startswith( 'on' ): 
    173                     raise IllegalHTML, 'Javascipt event "%s" not allowed.' % k 
     174                    logger.debug('Javascript event "%s" not allowed.' % k) 
    174175 
    175176                if v.lower().startswith( 'javascript:' ): 
    176                     raise IllegalHTML, 'Javascipt URI "%s" not allowed.' % v 
     177                    logger.debug('Javascript URI "%s" not allowed.' % v) 
    177178 
    178179                self.result = '%s %s="%s"' % (self.result, k, v) 
     
    185186 
    186187        elif NASTY_TAGS.get( tag ): 
    187             raise IllegalHTML, 'Dynamic tag "%s" not allowed.' % tag 
     188            logger.debug('Dynamic tag "%s" not allowed.' % tag) 
    188189 
    189190        else: 
     
    226227            self.in_body = True 
    227228        elif NASTY_TAGS.get( tag ): 
    228             raise IllegalHTML, 'Dynamic tag "%s" not allowed.' % tag 
     229            logger.debug('Dynamic tag "%s" not allowed.' % tag) 
    229230        elif self.in_body: 
    230231            self.result = '%s ' % self.result