I have to change on more than 700 dtml pages the syntax of a link. There's any automatic way on ZOPE to find and replace those parts of code ? Thanks Alejandro
If you need simple string substitution, you could use the following Python script: ## Script (Python) "searchAndReplace" ## parameters=search_string,replace_string ## folder=context.folder_to_change for pt in folder.objectValues('Page Template'): body=pt.read() body=body.replace(search_string,replace_string) pt.write(body) print "Changed "+pt.id+" ("+pt.title+")" for dtml in folder.objectValues(['DTML Document','DTML Method']): body=dtml.document_src() body=body.replace(search_string,replace_string) dtml.manage_edit(body,dtml.title) print "Changed "+dtml.id()+" ("+dtml.title+")" return printed Place it anywhere where you can acquire the folder where the documents you want to change are located. It searches for all page templates, dtml documents and dtml methods in that folder and substitutes all ocurrences of the search_string with the replace_string. Carlos de la Guardia Aldea Systems On Mon, 1 Apr 2002 12:10:13 -0300 "Alejandro T. Singer" <alejandro.singer@systeam.com.ar> wrote:
I have to change on more than 700 dtml pages the syntax of a link.
There's any automatic way on ZOPE to find and replace those parts of code ?
Thanks
Alejandro
I have to change on more than 700 dtml pages the syntax of a link.
There's any automatic way on ZOPE to find and replace those parts of code ?
If you need simple string substitution, you could use the following Python script:
although I haven't tried them, there's a patch for search/replace support as a tab in the ZOPE Management Interface for folders (by the same author) : http://www.zope.org/Members/cguardia/replace/ it has also been productized : http://www.zope.org/Members/shh/ReplaceSupport no joke! ;-) Grant K Rauscher GeeKieR Enterprises http://www.geekier.com/
At 01.04.2002 12:10 -0300, Alejandro T. Singer wrote:
I have to change on more than 700 dtml pages the syntax of a link.
There's any automatic way on ZOPE to find and replace those parts of code ?
ReplaceSupport? http://www.zope.org/Members/shh/ReplaceSupport/ grz Stefan
participants (4)
-
Alejandro T. Singer -
Carlos de la Guardia -
Grant K Rauscher -
stefan holek