Skip to content

Commit

Permalink
Refactor: Feature/add service settings from @jendrusk (#31)
Browse files Browse the repository at this point in the history
* Services before refactor

* Added services settings

* Disabled create_service function

* Refactor: Feature/add service settings from @jendrusk

Co-authored-by: Andrzej <jendrusk@gmail.com>
  • Loading branch information
Alessio Fabiani and jendrusk authored Feb 21, 2022
1 parent 857c48a commit c2b733c
Show file tree
Hide file tree
Showing 19 changed files with 831 additions and 165 deletions.
7 changes: 4 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os
import sys
import os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -178,8 +179,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'gsconfig.tex', u'gsconfig Documentation',
u'David Winslow', 'manual'),
('index', 'gsconfig.tex', u'gsconfig Documentation',
u'David Winslow', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down
6 changes: 4 additions & 2 deletions examples/copy_layergroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@
from geoserver.catalog import Catalog

demo = Catalog("http://localhost:8080/geoserver/rest",
"admin", "geoserver")
"admin", "geoserver")

live = Catalog("http://localhost:8080/geoserver2/rest",
"admin", "geoserver")
"admin", "geoserver")

groupname = "Wayne"
prefix = "wayne_"


def resolve(layer, style):
if style is not None and style:
return (layer, style)
else:
return (layer, demo.get_layer(layer).default_style.name)


g = demo.get_layergroup("groupname")
resolved = [resolve(l, s) for (l, s) in zip(g.layers, g.styles)]

Expand Down
4 changes: 3 additions & 1 deletion examples/layersusing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

cat = Catalog("http://localhost:8080/geoserver/rest", "admin", "geoserver")


def has_the_style(l):
return (l.default_style.name == style_to_check or
any(s.name == style_to_check for s in l.styles))
any(s.name == style_to_check for s in l.styles))


print([l.name for l in cat.get_layers() if has_the_style(l)])
2 changes: 1 addition & 1 deletion examples/postgis_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@

cat.save(ds)
ds = cat.get_store(name)
components = dict((ext, "myfile." + ext) for ext in ["shp", "prj", "shx", "dbf"])
components = dict((ext, f"myfile.{ext}") for ext in ["shp", "prj", "shx", "dbf"])
cat.add_data_to_store(ds, "mylayer", components)
2 changes: 1 addition & 1 deletion examples/postgislayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
cat = Catalog("http://localhost:8080/geoserver/rest", "admin", "geoserver")

pg_stores = [s.name for s in cat.get_stores()
if s.resource_type == 'dataStore' and s.connection_parameters.get("dbtype") == "postgis"]
if s.resource_type == 'dataStore' and s.connection_parameters.get("dbtype") == "postgis"]

print(cat.get_resources(stores=pg_stores))
10 changes: 3 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="geoserver-restconfig",
version="2.0.4.10",
version="2.0.5",
description="GeoServer REST Configuration",
long_description=readme_text,
keywords="GeoServer REST Configuration",
Expand All @@ -26,7 +26,7 @@
],
package_dir={'': 'src'},
packages=find_packages('src'),
test_suite="test.catalogtests",
# test_suite="test.servicestests",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
Expand All @@ -35,10 +35,6 @@
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Scientific/Engineering :: GIS',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.8',
]
)
Loading

0 comments on commit c2b733c

Please sign in to comment.