[Zope] 2.3.2 - external method re module

Florian Konnertz florian.konnertz@web.de
Tue, 08 Jul 2003 00:40:08 +0200


Hi,

I have to change all stx links in a dtml doc to html which is not done 
for any reason. It's an old zope (2.3.2) :( python is 1.5.2
I tried with string.find, but i get a "string object has no atribute 
'find'" error.
So i guesses i have to use an External Method where i can use re.
In this method i do a re.findall for the stx link, i tried with several 
expressions, and one i need to use does not work which seems quite 
strange to me. I tried to track this down to the simplest parts, but up 
to now unsuccessfully so i need your help, please.
BTW in cli mode everything is fine if i start the same script with python1.5
Apparently it's a fault of the '"' character, the double quotes.

Here are the most simple pattern i tried, the double quotes quoted with 
\ and not, in triple quotes and not etc. Everytime i add the double 
quotes, my pattern fails. And my text definetly has several stx links in 
it!!

pattern = r'"\S+'
pattern = r'''"\S+'''
pattern = r'''\"\S+'''

Everything without d.quotes is ok, i.e.
urlchars         = r'[A-Za-z0-9/:@_%~#=&\.\-\?\+\$,]+'
urlendchar       = r'[A-Za-z0-9/]'
url              = r'["=]?((about|gopher|http|https|ftp|mailto|file):%s' 
   % urlendchar

this is the pattern i need:
link = r'(".+?"):%s' % (url)

which works fine on the cli.

TIA,
Florian

-- 
Florian Konnertz   ---   http://www.florian-konnertz.de	
http://openspirit.homelinux.net/noowiki/FrontPage
ZWiki about all topics, especially consciousness research
and wisdom traditions