示例#1
0
文件: server.py 项目: jivechang/mra
    def PUT(self, ows, format):
        """To enable or disable OGC service..."""

        mf = mra.get_available()
        data = get_data(name=ows, mandatory=["enabled"], authorized=["enabled"])
        is_enabled = data.pop("enabled")
        # TODO: That would be cool to be able to control each operation...
        values = {True: "*", "True": "*", "true": "*", 
                  False: "", "False": "", "false": ""}
        if is_enabled not in values:
            raise KeyError("\"%s\" is not valid" % is_enabled)
        mf.set_metadata("%s_enable_request" % ows, values[is_enabled])
        mf.save()

# Index:
urlmap(index, "")
# About version:
urlmap(version, "about", "version")
# Workspaces:
urlmap(workspaces, "workspaces")
urlmap(workspace, "workspaces", ())
# Datastores:
urlmap(datastores, "workspaces", (), "datastores")
urlmap(datastore, "workspaces", (), "datastores", ())
# Featuretypes:
urlmap(featuretypes, "workspaces", (), "datastores", (), "featuretypes")
urlmap(featuretype, "workspaces", (), "datastores", (), "featuretypes", ())
# Coveragestores:
urlmap(coveragestores, "workspaces", (), "coveragestores")
urlmap(coveragestore, "workspaces", (), "coveragestores", ())
# Coverages:
示例#2
0
文件: server.py 项目: juanluisrp/mra
        lg.clear()
        lg.add(*layers)

        mf.save()

    @HTTPCompatible()
    def DELETE(self, map_name, lg_name, format):

        mf = get_mapfile(map_name)
        with webapp.mightNotFound("layerGroup", mapfile=map_name):
            mf.delete_layergroup(lg_name)
        mf.save()


# Index:
urlmap(index, "")

# Mapfiles:
urlmap(mapfiles, "maps")
urlmap(named_mapfile, "maps", ())

# Workspaces:
urlmap(workspaces, "maps", (), "workspaces")
urlmap(workspace, "maps", (), "workspaces", ())

# Datastores:
urlmap(datastores, "maps", (), "workspaces", (), "datastores")
urlmap(datastore, "maps", (), "workspaces", (), "datastores", ())
# Featuretypes:
urlmap(featuretypes, "maps", (), "workspaces", (), "datastores", (), "featuretypes")
urlmap(featuretype, "maps", (), "workspaces", (), "datastores", (), "featuretypes", ())