def register(self,name,URI):
origname,name=name,self.validateName(name)
URI=self.validateURI(URI)
fn=self.translate(name)
self.lock.acquire()
try:
if os.access(fn,os.R_OK):
Log.msg('NameServer','name already exists:',name)
raise Pyro.errors.NamingError('name already exists',name)
try:
open(fn,'w').write(str(URI)+'\n')
self._dosynccall("register",origname,URI)
Log.msg('NameServer','registered',name,'with URI',str(URI))
except IOError,x:
if x.errno==errno.ENOENT:
raise Pyro.errors.NamingError('(parent)group not found')
elif x.errno==errno.ENOTDIR:
raise Pyro.errors.NamingError('parent is no group')
else:
raise Pyro.errors.NamingError(str(x))
finally:
self.lock.release()
评论列表
文章目录