Using ElementTree as backend for a chat web application issues

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Jun 10 23:47:54 EDT 2008


En Mon, 09 Jun 2008 15:32:00 -0300, Marcelo de Moraes Serpa  
<celoserpa at gmail.com> escribió:

> I've built a chat with a front-end Ajax client and backend usign  
> ElementTree
> to persist the data.
>
> In some circunstances I could not yet discover (it seems random) when I
> edit/save the structure, the structure gets corrupted, elementree seems  
> to
> get lost in its internal "cursor", usually something like this happens:
>
> <backend>
>  <chat_list>
>    <chat id="1">
>    <chat id="2">
>   </chat_list>
> </backend>id="3"/></backend>
>
> Pretty strange, and it drives the whole application unusable.
>
> I don't know if the concurrent nature of the application (multiple users
> using the client at almost the same time and sending data to the server
> which in turn must save the data to the same global.xml file) has  
> something
> to do with it - I don't know if ElementTree is suitable for this kind of
> thing. How to hanlde this concurrent issue?

I don't think it's a problem with ElementTree. Perhaps you are writing the  
same (global) configuration file from several threads at the same time?  
You may need some locking mechanism in that case.

-- 
Gabriel Genellina




More information about the Python-list mailing list