[Zope-dev] updating homebrew extension of structured text to standard

Jochen Knuth jok-zope@ipro.de
Tue, 16 Jul 2002 02:33:34 +0200


This is a multi-part message in MIME format.
--------------070405010606020607010106
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

Jochen Knuth  <jok-zope@ipro.de> wrote:
> 
>Hi,
>
>i have a ZClass with a property which is renderd as structured text. 
>Because i designed this ZClass before there was a standard for including 
>images, i made my own extension of structured text formating.
>Short: I used __imageobject__ as markup for the image.
>
>Now i want to update all my zclass instances to the new syntax (while 
>upgrading to Zope 2.5.1).
>
>I have a Python Script listKBE, which call an External Method updateKBE. 
>If i use it with a path with only a few ZClass instances (about 10) it 
>works (slowly). If i use it with a path with about 550 instances it 
>crashes or is extreme slow.
>Anyone to suggest a faster method?
>
>Thank you,
>Jochen

replying to myself:

i now do a ZopeFind (or correct: two nested ZopeFinds) in the External 
Method (attached) and give the result to the converter function. It 
works now reasonably fast, even with all my ZClass instances (about 600).

Is there so much overhead in Python Scripts calling an External method? 
(i used also ZopeFind in the PythonScript, in a variation of my previous 
mail)
Or is it the getObject() call in the Python Scripts?

Ciao,
Jochen
-- 
--------------------------------------------------
Jochen Knuth          WebMaster http://www.ipro.de
IPRO GmbH             Phone ++49-7152-93330
Steinbeisstr. 6       Fax ++49-7152-933340
71229 Leonberg        EMail: J.Knuth@ipro.de

--------------070405010606020607010106
Content-Type: text/plain;
 name="mailupdateKBEimage.py"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="mailupdateKBEimage.py"

IyEvdXNyL2xvY2FsL2Jpbi9weXRob24KaW1wb3J0IHN0cmluZwppbXBvcnQgcmUKCmRlZiBw
dW5jX2Z1bmMoZXhjbHVkZSk6CiAgICBwdW5jID0gcicnCiAgICBmb3IgY2hhciBpbiBzdHJp
bmcucHVuY3R1YXRpb246CiAgICAgICAgaWYgY2hhciBub3QgaW4gZXhjbHVkZToKICAgICAg
ICAgICAgcHVuYyA9IHB1bmMgKyByJ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