Hi, I just discovered that my Data.fs get's periodically crashed. The symptom is that one single external method in Zope will be presented as a folder. I can't edit the method nor delete it. In the output I can find many messages like ZODB Couldn't load state for '\000\000\000\000\000\000\000\263' (The numbers are just guessed since I don't have them currently.) After the first occurence of the problem I copied all of my projects into a clean new Data.fs but the problem came back instantly. Now I could determine how to prevent the problem: I have to change the implementation of my external method. The external method is mostly a copy of the method thousands_commas in DT_var.py. All I did is to replace dots by commas and vice versa to implement the German representation of numbers: def FormatPreis( v, n=2, thou=regex.compile( "\([0-9]\)\([0-9][0-9][0-9]\([,.]\|$\)\)").search): v = "%.*f" % ( n, v ) vl = string.split(v,'.') if not vl: return v v=vl[0] del vl[0] if vl: s = ',' + string.join(vl,',') else: s = '' l=thou(v) while l >= 0: v=v[:l+1]+'.'+v[l+1:] l=thou(v) return v+s When this method gets called by some of my dtml-documents Data.fs gets crashed. (Therefore I started to make backups every few minutes.) Since I replaced the method above by a very simple method def FormatPreis( v, n=2 ): return str(v) my data.fs stays intact! So what's happening here??? I hope there is no major problem within Zope. But I would like to see a hint what's going on. Thank you for your help! -- connection reset by Peer _______________________________________________________________________ Dr. Peer Griebel Tel. +49 7581 4831 23 Geschäftsführer Fax. +49 7581 4831 11 Knoll Informationssysteme GmbH http://www.knoll-is.de Dreiköniggasse 17 mailto:peer@knoll-is.de 88348 Saulgau privat: mailto:peer.griebel@gmx.de
On Fri, 12 May 2000, Dr. Peer Griebel wrote:
def FormatPreis( v, n=2, thou=regex.compile( "\([0-9]\)\([0-9][0-9][0-9]\([,.]\|$\)\)").search): v = "%.*f" % ( n, v ) vl = string.split(v,'.') if not vl: return v v=vl[0] del vl[0] if vl: s = ',' + string.join(vl,',') else: s = '' l=thou(v) while l >= 0: v=v[:l+1]+'.'+v[l+1:] l=thou(v) return v+s
my data.fs stays intact! So what's happening here??? I hope there is no major problem within Zope. But I would like to see a hint what's going on.
Hmm my guess is that the problem arises because you pass the regex as a default argument. Pavlos
FYI: I managed to solve the problem. I simply took the third parameter out of the parameter list and initialized the variable inside the function: def FormatPreis( v, n=2, thou=regex.compile( "\([0-9]\)\([0-9][0-9][0-9]\([,.]\|$\)\)").search) becomes def FormatPreis( v, n=2 ) The new code is a little bit less efficient. But this doesn't hurt us. Special thanks to Pavlos Christoforou <pavlos@gaaros.com>! -- connection reset by Peer _______________________________________________________________________ Dr. Peer Griebel Tel. +49 7581 4831 23 Geschäftsführer Fax. +49 7581 4831 11 Knoll Informationssysteme GmbH http://www.knoll-is.de Dreiköniggasse 17 mailto:peer@knoll-is.de 88348 Saulgau privat: mailto:peer.griebel@gmx.de
participants (2)
-
Dr. Peer Griebel -
Pavlos Christoforou