naming.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:SameKeyProxy 作者: xzhou 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号