[Zope-dev] why does my externalmethod generate a ZODB transaction

Joachim Schmitz js@aixtraware.de
Wed, 5 Jul 2000 21:50:44 +0200 (CEST)


Hi,

I wrote an external method from which I call a ZSQL-method, this runs fine
and returns the correct results, but when I look at the ZODB transactions,
I see that for each call of the method a transaction is recorded. Even
worse, when I make an error in my method, the folder from which I invoked
the method is no longer accesseble. I have to undo the transaction first,
that's how I found out that there is a transaction happening.


here is the code of the External-method:

import string
import sys
sys.path[0:0]=["/usr/local/Zope-2.1.4/Extensions"]
from DocumentTemplate import *
def dump(self,EA,**kwa):
    #return EA,kwa
    s = "<br>"
    if hasattr(self,EA):
        ea = apply(getattr(self,EA),(),kwa)
        #return ea._names,"<br>",ea._schema
        ead = ea.__dict__
        for r in ead.keys():
            s = s + r + "<br>"
            i=getattr(ea,r)
            if type(i) == type([]) and len(i) > 0:
                s = s + str(i) + " <br> "
                for n in i:
                    s = s + str(n) + " | "
                s=s+"<br>"
            elif type(i) == type({}):
                s = s + str(i) + " <br> "
                for n in i.items():
                    s = s + str(n) + " | "
            s=s+"<br>"
    return s

def workform(self,REQUEST):
    "Die Masken EinAusgabe"
    scol = "movie_id"
    sval = "a%"
    srel = "like"
    return dump(self,"Row_search",scol=scol,sval=sval,srel=srel)

this dumps the result of the ZSQL-method, I call it from a dtml-method
"testForm" like this:

<dtml-var standard_html_header>
<dtml-var "RForm(REQUEST)">    <--- this calls workform
<dtml-var standard_html_footer>

when invoking this like .../Movies/testForm

I have an entry in the undoable transactions:

...Movies/testForm by super on Jul 4 at 21:21:31  

By the way why is the day one day off the machine REDhat 6.2 Zope-2.1.4
has the correct date and shows now:
 

Wed Jul  5 21:49:01 CEST 2000 

Mit freundlichen Grüßen

Joachim Schmitz  

          
AixtraWare, Ing. Büro für Internetanwendungen
Hüsgenstr. 33a, D-52457 Aldenhoven  
Telefon: +49-2464-8851, FAX: +49-2464-905163