gsxml.py 文件源码

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

项目:layman 作者: CCSS-CZ 项目源码 文件源码
def _createRole(self, role, rrRoot):
        """ Create Role. If exists, do nothing. """

        changed = False

        # Check for the role
        if sys.hexversion >= 0x02070000: # Python 2.7 or more
            roleElem = rrRoot.find("./{http://www.geoserver.org/security/roles}roleList/{http://www.geoserver.org/security/roles}role[@id='"+role+"']")
        else: # Python 2.6 or less
            roleElem = self._xPath26Find(rrRoot, "./{http://www.geoserver.org/security/roles}roleList/{http://www.geoserver.org/security/roles}role", "id", role)

        if roleElem is None:
            # Create the role
            roleElem     = Xml.Element("{http://www.geoserver.org/security/roles}role", {"id":role}) 
            roleListElem = rrRoot.find("./{http://www.geoserver.org/security/roles}roleList")
            roleListElem.append(roleElem)      
            changed = True

        return changed
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号