[Zope] Zope pretends to receive and send XMLRPC data,
but strace sees nothing ! (fwd)
yacine chaouche
yacinechaouche at gmail.com
Fri Jan 19 05:02:38 EST 2007
It writes and reads objects in the session, maybe the probleme comes from
here ? Here's a little sinppet :
def toutCompter(self):
"""
xmlrpc methode, called from a web borwser.
"""
documentXML = ComptageXML()
#this reads and writes objects in the session
dicoLignes = self._fabriquerDicoLignes()
#do things with dicoLignes
for inumLigneCourante in xrange(borneInf,borneSup) :
snumLigneCourante = str(inumLigneCourante)
ligne = dicoLignes[snumLigneCourante]["requete"]
#do things here
self._ajouterAuDico(snumLigneCourante,ligne,comptage,arbre)
if ligne :
self._mettreEnSession(resultats)
response = self.REQUEST.RESPONSE
response.setHeader("Content-Type","text/xml")
response.setHeader("charset","utf-8")
chaineXML = documentXML.formatXML()
print "sending results to "+addresseIP
return chaineXML
def _fabriquerDicoLignes(self):
formulaire = self.getForm()
dicoLignes = self.getSession(self,"dicoLignes") or {}
for key in formulaire.keys():
#do things...
self.setSession("dicoLignes", dicoLignes)
return dicoLignes
def _fabriquerListeLignes(self):
dicoLignes = RacineAbstraite.getSession(self,"dicoLignes") or {}
listeNumeros = dicoLignes.keys()
listeNumeros.sort( lambda x,y: cmp(int(x), int(y)) )
return [ dicoLignes[str(inumeroLigne)]["requete"] for inumeroLigne
in \
sorted( [int(snumeroLigne) for snumeroLigne in
dicoLignes.keys()] ) ]
def _ajouterAuDico(self,p_snumeroCle,p_ligne,p_comptage,p_arbre):
dicoLignes = RacineAbstraite.getSession(self,'dicoLignes') or {}
dicoLignes[p_snumeroCle] =
{'requete':p_ligne,'comptage':p_comptage,'arbre':p_arbre}
self.setSession('dicoLignes',dicoLignes)
def _mettreEnSession(self,p_resultats):
"""
Mettre en session les résultats d'un comptage.
"""
# Initialise de la SESSION
dicoResultatRecherche = {
'listeCriteres' : [self._fabriquerListeLignes(),
self.getForm('numeroLigne')],
'nombreEntreprises' : p_resultats[0][0],
'listeComptage' : p_resultats,
'listeEntreprises' : [],
}
#On conserve la requete et le resultat en session
self.setSession('resultatRecherche', p_dicoResultatRecherche.copy())
When toutCompter is called by browser 1, then he will write and read, say,
the dicoLignes object in the session.
When toutCompter is called by browser 2 parallely, is it the same dicoLignes
object that it tries to access or another one is created ? can there be
conflicts somehow ?
Y.Chaouche
2007/1/19, yacine chaouche <yacinechaouche at gmail.com>:
>
> I mean triple couples of lines of code.
>
> 2007/1/19, yacine chaouche <yacinechaouche at gmail.com>:
> >
> > The toutCompter methode does a lot of thing and it would take a triple
> > couples of lines to describe what it does all.
> > Anyway, is there a way for me to detect ConflictErrors ? they don't
> > appear on the console so i guess they are catched.
> >
> > Y.Chaouche
> >
> > 2007/1/19, Gabriel Genellina <gagsl-zope at yahoo.com.ar >:
> > >
> > > At Thursday 18/1/2007 16:30, Andreas Jung wrote:
> > >
> > >
> > > ><zope trace to the console>
> > > >ip: 10.75.49.155 requests counting of lines 1 to 11
> > > >ip: 10.75.49.51 requests counting of lines 1 to 11
> > > >sending results to 10.75.49.155
> > > >sending results to 10.75.49.51
> > > >ip: 10.75.49.51 requests counting of lines 1 to 11
> > > >sending results to 10.75.49.51
> > > ></zope trace>
> > > >
> > > >
> > > >Zope says he got 2 requests form 10.75.49.51 and sent it the results
> > > 2
> > > >times. Ok, let's check the tcpflow then for these supposed
> > > connections :
> > > >[...]
> > > >Allright, there is only ONE POST request. So zope didnt really got
> > > two
> > > >requests. Now let's see if it sent the data two times as it presumes
> > > :
> > > >[...]
> > > >The results were sent just one time, not two.
> > > >
> > > >What is going on here ?
> > >
> > > What does the toutCompter method really does? Does it modify some
> > > object state? That might provoke a ConflictError, forcing a
> > > transaction abort and the request to be re-tried (up to three times,
> > > silently, then it goes logged).
> > >
> > >
> > > --
> > > Gabriel Genellina
> > > Softlab SRL
> > >
> > >
> > >
> > >
> > >
> > >
> > > __________________________________________________
> > > Preguntá. Respondé. Descubrí.
> > > Todo lo que querías saber, y lo que ni imaginabas,
> > > está en Yahoo! Respuestas (Beta).
> > > ¡Probalo ya!
> > > http://www.yahoo.com.ar/respuestas
> > >
> > > _______________________________________________
> > > Zope maillist - Zope at zope.org
> > > http://mail.zope.org/mailman/listinfo/zope
> > > ** No cross posts or HTML encoding! **
> > > (Related lists -
> > > http://mail.zope.org/mailman/listinfo/zope-announce
> > > http://mail.zope.org/mailman/listinfo/zope-dev )
> > >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20070119/aeb7fa38/attachment.htm
More information about the Zope
mailing list