Hello list, I've built a chat with a front-end Ajax client and backend usign ElementTree to persist the data.
The problem is that the xml structure I use to persist some of the global configuration of the application usually gets corrupted, for example, let's say the structure is something like: <backend> <chat_list> <chat .../> <chat .../> </chat_list> </backend> 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? My code seems to work ok, as when the XML doesn't get corrupted, all the features of the chat work nicely. I can show the code here, but it is too big and I don't have a clue where this problem would be sitted. It is simple, it just uses the parse method of elementree to read the xml and the write method to write, nothing fancy. If someone could "smell" what could be the cause of this problem and tell me, I would be grateful.
-- http://mail.python.org/mailman/listinfo/python-list