[Zope3-checkins] SVN: messageboard/trunk/step03/ Updated Regex once more; the tests failed before...geez.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 11 13:46:46 EDT 2004


Log message for revision 27005:
  Updated Regex once more; the tests failed before...geez.
  


Changed:
  U   messageboard/trunk/step03/browser/widgets.py
  U   messageboard/trunk/step03/fields.py


-=-
Modified: messageboard/trunk/step03/browser/widgets.py
===================================================================
--- messageboard/trunk/step03/browser/widgets.py	2004-08-11 17:40:45 UTC (rev 27004)
+++ messageboard/trunk/step03/browser/widgets.py	2004-08-11 17:46:45 UTC (rev 27005)
@@ -30,7 +30,7 @@
             input = re.sub(regex, '', input)
 
         if self.context.allowed_tags:
-            regex = allowed_regex %'(?: |/)|'.join(
+            regex = allowed_regex %'[ />]|'.join(
                 self.context.allowed_tags)
             input = re.sub(regex, '', input)
 

Modified: messageboard/trunk/step03/fields.py
===================================================================
--- messageboard/trunk/step03/fields.py	2004-08-11 17:40:45 UTC (rev 27004)
+++ messageboard/trunk/step03/fields.py	2004-08-11 17:46:45 UTC (rev 27005)
@@ -21,7 +21,7 @@
 from zope.schema.interfaces import ValidationError
 
 forbidden_regex = r'</?(?:%s).*?/?>'
-allowed_regex = r'</??(?!%s(?: |/))[a-zA-Z0-9]*? ?(?:[a-z0-9]*?=?".*?")*/??>'
+allowed_regex = r'</??(?!%s[ />])[a-zA-Z0-9]*? ?(?:[a-z0-9]*?=?".*?")*/??>'
 
 class ForbiddenTags(ValidationError):
     __doc__ = u"""Forbidden HTML Tags used."""
@@ -46,7 +46,7 @@
                 raise ForbiddenTags(value, self.forbidden_tags)
 
         if self.allowed_tags:
-            regex = allowed_regex %'(?: |/)|'.join(self.allowed_tags)
+            regex = allowed_regex %'[ />]|'.join(self.allowed_tags)
             if re.findall(regex, value):
                 raise ForbiddenTags(value, self.allowed_tags)
 



More information about the Zope3-Checkins mailing list