[ZODB-Dev] Investigating a Zope reference leak... tracking object creation

Chris Withers chris at simplistix.co.uk
Tue Feb 1 05:08:47 EST 2005


Ben Last (ZODBDev) wrote:

> In slightly bastardized form, yes.  This is normally invoked from ZPT 
> using an idiom:
> <img tal:replace="structure 
> python:here.scripts.getGraphic(here,environment,'myimage.gif',...)"/>

And does this provoke your leak?

> def getGraphic(here, target, environment, style=None, css_class=None, 
> border=None, wap=False, title=None, alt=None, longdesc=None, **kwargs):

Are any arguments passed which aren't simple strings?

>     if style:
>         #TAL doesn't allow ';' in the source, so we use '$' instead.

This isn't true, they just need to be quoted by doubling them, eg:
tal:content="string:a semicolon:;; ..see :-)"

>     if flash is None:
>         flash = getattr(environment,'flash',False)

What's flash?

>     #Create a dictish object to hold the attributes we return
>     graphic = Products.PythonScripts.standard.Object()

I dunno what this is, but it makes me suspicious.
If you want a dict, why not just use a dict?!

>         tag = 
> doTag(img,alt=alt,title=title,style=style,wap=wap,css_class=css_class,**kwargs).replace(request.BASE1,environment.relpath).strip() 

What's "doTag" ?

>         url =  
> img.absolute_url().replace(request.BASE1,environment.relpath)

Hmm, have you tried .absolute_url(1) to replace the stuff above?

>     except AttributeError:
>         pass

Why pass? might be interesting to see what throws attribute errors and why?

>     if swftarget:
>         graphic = flashOverride(here,swftarget,graphic)

What does this do?

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the ZODB-Dev mailing list