From: hannosch <svn...@pl...> - 2006-08-21 06:44:02
|
Author: hannosch Date: Mon Aug 21 06:43:58 2006 New Revision: 10553 Modified: plone.i18n/trunk/plone.i18n.egg-info/PKG-INFO plone.i18n/trunk/plone/i18n/normalizer/__init__.py plone.i18n/trunk/plone/i18n/normalizer/tests/test_normalizer.py Log: Updated normalizer logic to comply to the latest changes in CMFPlone. Modified: plone.i18n/trunk/plone.i18n.egg-info/PKG-INFO ============================================================================== --- plone.i18n/trunk/plone.i18n.egg-info/PKG-INFO (original) +++ plone.i18n/trunk/plone.i18n.egg-info/PKG-INFO Mon Aug 21 06:43:58 2006 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: plone.i18n -Version: 0.1dev-r10514 +Version: 0.1dev-r10524 Summary: Advanced i18n/l10n features Home-page: http://svn.plone.org/svn/plone/plone.i18n Author: Plone Foundation Modified: plone.i18n/trunk/plone/i18n/normalizer/__init__.py ============================================================================== --- plone.i18n/trunk/plone/i18n/normalizer/__init__.py (original) +++ plone.i18n/trunk/plone/i18n/normalizer/__init__.py Mon Aug 21 06:43:58 2006 @@ -9,8 +9,9 @@ # Define and compile static regexes FILENAME_REGEX = re.compile(r"^(.+)\.(\w{,4})$") +IGNORE_REGEX = re.compile(r"[']") NON_WORD_REGEX = re.compile(r"[\W\-]+") -DANGEROUS_CHARS_REGEX = re.compile(r"[?&/:\\#]+") +DANGEROUS_CHARS_REGEX = re.compile(r"[?&/:\\#<>!$%^*()]+") EXTRA_DASHES_REGEX = re.compile(r"(^\-+)|(\-+$)") class IDNormalizer(object): @@ -56,6 +57,7 @@ base = m.groups()[0] ext = m.groups()[1] + base = IGNORE_REGEX.sub('', base) base = NON_WORD_REGEX.sub('-', base) base = EXTRA_DASHES_REGEX.sub('', base) @@ -103,6 +105,7 @@ base = m.groups()[0] ext = m.groups()[1] + base = IGNORE_REGEX.sub('', base) base = DANGEROUS_CHARS_REGEX.sub('-', base) base = EXTRA_DASHES_REGEX.sub('', base) Modified: plone.i18n/trunk/plone/i18n/normalizer/tests/test_normalizer.py ============================================================================== --- plone.i18n/trunk/plone/i18n/normalizer/tests/test_normalizer.py (original) +++ plone.i18n/trunk/plone/i18n/normalizer/tests/test_normalizer.py Mon Aug 21 06:43:58 2006 @@ -32,6 +32,9 @@ >>> util.normalize(u' Whitespace and capital Letters ') 'whitespace-and-capital-letters' + + >>> util.normalize(u">here's another!") + 'heres-another' """ def testURLNormalizer(): @@ -45,6 +48,9 @@ >>> util.normalize(u' Whitespace and capital Letters ') 'Whitespace and capital Letters' + + >>> util.normalize(u">here's another!") + 'heres another' """ def testLocaleAwareURLNormalizer(): |