• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python support.url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sextante.admintools.geoserver.support.url函数的典型用法代码示例。如果您正苦于以下问题:Python url函数的具体用法?Python url怎么用?Python url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了url函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: add_data_to_store

    def add_data_to_store(self, store, name, data, workspace=None, overwrite = False, charset = None):
        if isinstance(store, basestring):
            store = self.get_store(store, workspace=workspace)
        if workspace is not None:
            workspace = _name(workspace)
            assert store.workspace.name == workspace, "Specified store (%s) is not in specified workspace (%s)!" % (store, workspace)
        else:
            workspace = store.workspace.name
        store = store.name

        if isinstance(data, dict):
            bundle = prepare_upload_bundle(name, data)
        else:
            bundle = data

        params = dict()
        if overwrite:
            params["update"] = "overwrite"
        if charset is not None:
            params["charset"] = charset

        message = open(bundle)
        headers = { 'Content-Type': 'application/zip', 'Accept': 'application/xml' }
        upload_url = url(self.service_url, 
            ["workspaces", workspace, "datastores", store, "file.shp"], params) 

        try:
            headers, response = self.http.request(upload_url, "PUT", message, headers)
            self._cache.clear()
            if headers.status != 201:
                raise UploadError(response)
        finally:
            unlink(bundle)
开发者ID:homann,项目名称:Quantum-GIS,代码行数:33,代码来源:catalog.py


示例2: get_layergroup

 def get_layergroup(self, name=None):
     try: 
         group_url = url(self.service_url, ["layergroups", name + ".xml"])
         group = self.get_xml(group_url)
         return LayerGroup(self, group.find("name").text)
     except FailedRequestError:
         return None
开发者ID:homann,项目名称:Quantum-GIS,代码行数:7,代码来源:catalog.py


示例3: get_style

 def get_style(self, name):
     try:
         style_url = url(self.service_url, ["styles", name + ".xml"])
         dom = self.get_xml(style_url)
         return Style(self, dom.find("name").text)
     except FailedRequestError:
         return None
开发者ID:homann,项目名称:Quantum-GIS,代码行数:7,代码来源:catalog.py


示例4: get_resources

    def get_resources(self):
        res_url = url(self.catalog.service_url,
            ["workspaces", self.workspace.name, "datastores", self.name, "featuretypes.xml"])
        xml = self.catalog.get_xml(res_url)
        def ft_from_node(node):
            return featuretype_from_index(self.catalog, self.workspace, self, node)

        return [ft_from_node(node) for node in xml.findall("featureType")]
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:8,代码来源:store.py


示例5: create_style

    def create_style(self, name, data, overwrite = False):
        if overwrite == False and self.get_style(name) is not None:
            raise ConflictingDataError("There is already a style named %s" % name)

        headers = {
            "Content-type": "application/vnd.ogc.sld+xml",
            "Accept": "application/xml"
        }

        if overwrite:
            style_url = url(self.service_url, ["styles", name + ".sld"])
            headers, response = self.http.request(style_url, "PUT", data, headers)
        else:
            style_url = url(self.service_url, ["styles"], dict(name=name))
            headers, response = self.http.request(style_url, "POST", data, headers)

        self._cache.clear()
        if headers.status < 200 or headers.status > 299: raise UploadError(response)
开发者ID:homann,项目名称:Quantum-GIS,代码行数:18,代码来源:catalog.py


示例6: get_layers

 def get_layers(self, resource=None):
     if isinstance(resource, basestring):
         resource = self.get_resource(resource)
     layers_url = url(self.service_url, ["layers.xml"])
     description = self.get_xml(layers_url)
     lyrs = [Layer(self, l.find("name").text) for l in description.findall("layer")]
     if resource is not None:
         lyrs = [l for l in lyrs if l.resource.href == resource.href]
     # TODO: Filter by style
     return lyrs
开发者ID:homann,项目名称:Quantum-GIS,代码行数:10,代码来源:catalog.py


示例7: create_coveragestore

    def create_coveragestore(self, name, data, workspace=None, overwrite=False):
        if not overwrite:
            try:
                store = self.get_store(name, workspace)
                msg = "There is already a store named " + name
                if workspace:
                    msg += " in " + str(workspace)
                raise ConflictingDataError(msg)
            except FailedRequestError:
                # we don't really expect that every layer name will be taken
                pass

        if workspace is None:
            workspace = self.get_default_workspace()
        headers = {
            "Content-type": "image/tiff",
            "Accept": "application/xml"
        }

        archive = None
        ext = "geotiff"

        if isinstance(data, dict):
            archive = prepare_upload_bundle(name, data)
            message = open(archive)
            if "tfw" in data:
                headers['Content-type'] = 'application/archive'
                ext = "worldimage"
        elif isinstance(data, basestring):
            message = open(data)
        else:
            message = data

        cs_url = url(self.service_url,
            ["workspaces", workspace.name, "coveragestores", name, "file." + ext])

        try:
            headers, response = self.http.request(cs_url, "PUT", message, headers)
            self._cache.clear()
            if headers.status != 201:
                raise UploadError(response)
        finally:
            if archive is not None:
                unlink(archive)
开发者ID:homann,项目名称:Quantum-GIS,代码行数:44,代码来源:catalog.py


示例8: create_featurestore

    def create_featurestore(self, name, data, workspace=None, overwrite=False, charset=None):
        if not overwrite:
            try:
                store = self.get_store(name, workspace)
                msg = "There is already a store named " + name
                if workspace:
                    msg += " in " + str(workspace)
                raise ConflictingDataError(msg)
            except FailedRequestError:
                # we don't really expect that every layer name will be taken
                pass

        if workspace is None:
            workspace = self.get_default_workspace()
        workspace = _name(workspace)
        params = dict()
        if charset is not None:
            params['charset'] = charset
        ds_url = url(self.service_url,
            ["workspaces", workspace, "datastores", name, "file.shp"], params)

        # PUT /workspaces/<ws>/datastores/<ds>/file.shp
        headers = {
            "Content-type": "application/zip",
            "Accept": "application/xml"
        }
        if isinstance(data,dict):
            logger.debug('Data is NOT a zipfile')
            archive = prepare_upload_bundle(name, data)
        else:
            logger.debug('Data is a zipfile')
            archive = data
        message = open(archive)
        try:
            headers, response = self.http.request(ds_url, "PUT", message, headers)
            self._cache.clear()
            if headers.status != 201:
                raise UploadError(response)
        finally:
            unlink(archive)
开发者ID:homann,项目名称:Quantum-GIS,代码行数:40,代码来源:catalog.py


示例9: href

 def href(self):
     return url(self.catalog.service_url, ["layergroups", self.name + ".xml"])
开发者ID:homann,项目名称:Quantum-GIS,代码行数:2,代码来源:layergroup.py


示例10: datastore_url

 def datastore_url(self):
     return url(self.catalog.service_url, ["workspaces", self.name, "datastores.xml"])
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:2,代码来源:workspace.py


示例11: reload

 def reload(self):
     reload_url = url(self.service_url, ['reload'])
     response = self.http.request(reload_url, "POST")
     self._cache.clear()
     return response
开发者ID:homann,项目名称:Quantum-GIS,代码行数:5,代码来源:catalog.py


示例12: coveragestore_url

 def coveragestore_url(self):
     return url(self.catalog.service_url, ["workspaces", self.name, "coveragestores.xml"])
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:2,代码来源:workspace.py


示例13: href

 def href(self):
     return url(self.catalog.service_url,
         ["workspaces", self.workspace.name,
          "datastores", self.store.name,
          "featuretypes", self.name + ".xml"])
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:5,代码来源:resource.py


示例14: get_styles

 def get_styles(self):
     styles_url = url(self.service_url, ["styles.xml"])
     description = self.get_xml(styles_url)
     return [Style(self, s.find('name').text) for s in description.findall("style")]
开发者ID:homann,项目名称:Quantum-GIS,代码行数:4,代码来源:catalog.py


示例15: body_href

 def body_href(self):
     return url(self.catalog.service_url, ["styles", self.name + ".sld"])
开发者ID:homann,项目名称:Quantum-GIS,代码行数:2,代码来源:style.py


示例16: href

 def href(self):
     path = [ "workspaces",
              self.workspace.name, "datastores"]
     query = dict(name=self.name)
     return url(self.catalog.service_url, path, query)
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:5,代码来源:store.py



注:本文中的sextante.admintools.geoserver.support.url函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ftools.FToolsUtils类代码示例发布时间:2022-05-27
下一篇:
Python sextante.runalg函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap