[cpif] r22 - trunk

svn at argo.es svn at argo.es
Thu Apr 26 20:11:30 CEST 2007


Author: jcea
Date: Thu Apr 26 20:11:29 2007
New Revision: 22

Log:
Mas compatibilidad windows

Modified:
   trunk/storage.py

Modified: trunk/storage.py
==============================================================================
--- trunk/storage.py	(original)
+++ trunk/storage.py	Thu Apr 26 20:11:29 2007
@@ -8,8 +8,13 @@
 # de persistencia con acceso via unix socket
 
 def storage(path) :
-  import berkeleydb_storage
-  st=berkeleydb_storage.BerkeleyDBStorage(path,do_recover=True,durable=False,async_log_write=True)
+  try :
+    import berkeleydb_storage
+    st=berkeleydb_storage.BerkeleyDBStorage(path,do_recover=True,durable=False,async_log_write=True)
+  except :
+    print >>sys.stderr,"ATENCION: Usando el backend durus normal..."
+    from durus.file_storage import FileStorage
+    st=FileStorage(os.path.join(path,"db.durus"))
 
   def storage_background(storage,path) :
     from durus.storage_server import StorageServer
@@ -22,7 +27,7 @@
       import os
       os._exit(os.EX_OK)
 
-  path+="/unix_socket"
+  path=os.path.join(path,"unix_socket")
   import threading
   storage_thread=threading.Thread(target=storage_background,args=(st,path))
   storage_thread.setDaemon(True)
@@ -38,10 +43,10 @@
   return storage_thread,conn_constructor
 
 def storage_test(path) :
-  import os
+  import os,os.path
   for i in os.listdir(path) :
     if i[0]=="." : continue
-    os.remove(path+"/"+i)
+    os.remove(os.path.join(path,i))
 
   return storage(path)
 



More information about the cpif mailing list