File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2222import logging
2323import socket
2424import uuid
25+ import os
2526
2627from ZKeeperAPI import zkapi
2728
29+ PY27 = sys .version_info >= (2 ,7 )
2830
2931class ZKLockServer (object ):
3032 def __init__ (self , ** config ):
@@ -43,7 +45,10 @@ def __init__(self, **config):
4345 raise Exception (msg )
4446
4547 self .lock = config ['name' ]
46- self .lockpath = '/{}/{}' .format (self .id , self .lock )
48+ if PY27 :
49+ self .lockpath = '/{}/{}' .format (self .id , self .lock )
50+ else :
51+ self .lockpath = '/%s/%s' % (self .id , self .lock )
4752 self .locked = False
4853 self .lock_content = socket .gethostname () + str (uuid .uuid4 ())
4954 except Exception as err :
@@ -65,7 +70,10 @@ def getlock(self):
6570
6671 def set_lock_name (self , name ):
6772 self .lock = name
68- self .lockpath = '/{}/{}' .format (self .id , self .lock )
73+ if PY27 :
74+ self .lockpath = '/{}/{}' .format (self .id , self .lock )
75+ else :
76+ self .lockpath = '/%s/%s' % (self .id , self .lock )
6977
7078 def releaselock (self ):
7179 try :
You can’t perform that action at this time.
0 commit comments