[Zope-dev] sre and import_class

Matt Behrens matt.behrens@kohler.com
Tue, 26 Feb 2002 14:33:38 -0500


re seems to prefer sre over pre these days, so the following bit of 
Products/PythonScripts/module_access_examples.py no longer works:

# from re import RegexObject, MatchObject
# allow_class(RegexObject)
# allow_class(MatchObject)

The reason seems to be that sre doesn't define RegexObject and 
MatchObject, preferring instead to define types SRE_Pattern and 
SRE_Match, which can't be imported.

Arguably this is probably a deficiency in sre, but as it stands, it 
seems to be currently impossible to use re inside of python scripts. 
I'm using an EM.

I'll file a Collector issue on this one, unless someone has a solution, 
or someone wants to just take the 're' section out of 
module_access_examples.py.