Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	pyramid_georest/routes.py
  • Loading branch information
vvmruder committed Nov 23, 2017
2 parents 669ad64 + 1509def commit 838d881
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 244 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ docs/_build/
# PyBuilder
target/

/venv/
14 changes: 6 additions & 8 deletions pyramid_georest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: iso-8859-1 -*-
# -*- coding: utf-8 -*-

# Copyright (c) 2012 - 2015, GIS-Fachstelle des Amtes für Geoinformation des Kantons Basel-Landschaft
# Copyright (c) 2012 - 2015, GIS-Fachstelle des Amtes f�r Geoinformation des Kantons Basel-Landschaft
# All rights reserved.
#
# This program is free software and completes the GeoMapFish License for the geoview.bl.ch specific
Expand All @@ -17,13 +17,10 @@
import logging
from pyramid.config import Configurator
from pyramid.exceptions import ConfigurationConflictError
from pyramid_georest.lib.renderer import RestfulJson, RestfulXML, RestfulModelJSON, RestfulModelXML, RestfulGeoJson
from pyramid_georest.lib.renderer import RestfulJson, RestfulXML, RestfulModelJSON, RestfulModelXML, \
RestfulGeoJson
from pyramid_georest.lib.rest import Api, Service
from pyramid_mako import add_mako_renderer
from sqlalchemy import Column, types
from sqlalchemy import MetaData
from sqlalchemy import text
from sqlalchemy.ext.declarative import declarative_base

__author__ = 'Clemens Rudert'
__create_date__ = '23.07.2015'
Expand Down Expand Up @@ -74,7 +71,8 @@ def includeme(config):
# add request attributes

# global database connection holder see database script/rest script in api class
# this feature is mainly used to reduce open database connections. They will be shared if they are exactly the same.
# this feature is mainly used to reduce open database connections. They will be shared if they are exactly
# the same.
config.registry.pyramid_georest_database_connections = {}
# global api holder
config.registry.pyramid_georest_apis = {}
Expand Down
10 changes: 5 additions & 5 deletions pyramid_georest/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: iso-8859-1 -*-
# -*- coding: utf-8 -*-

# Copyright (c) 2012 - 2015, GIS-Fachstelle des Amtes für Geoinformation des Kantons Basel-Landschaft
# Copyright (c) 2012 - 2015, GIS-Fachstelle des Amtes f�r Geoinformation des Kantons Basel-Landschaft
# All rights reserved.
#
# This program is free software and completes the GeoMapFish License for the geoview.bl.ch specific
# parts of the code. You can redistribute it and/or modify it under the terms of the GNU General
# parts of the code. You can redistribute it and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
#
# The above copyright notice and this permission notice shall be included in all copies or substantial
# portions of the Software.

Expand Down
10 changes: 5 additions & 5 deletions pyramid_georest/lib/database.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: iso-8859-1 -*-
# -*- coding: utf-8 -*-

# Copyright (c) 2012 - 2016, GIS-Fachstelle des Amtes für Geoinformation des Kantons Basel-Landschaft
# Copyright (c) 2012 - 2016, GIS-Fachstelle des Amtes f�r Geoinformation des Kantons Basel-Landschaft
# All rights reserved.
#
# This program is free software and completes the GeoMapFish License for the geoview.bl.ch specific
# parts of the code. You can redistribute it and/or modify it under the terms of the GNU General
# parts of the code. You can redistribute it and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
#
# The above copyright notice and this permission notice shall be included in all copies or substantial
# portions of the Software.
from sqlalchemy import create_engine
Expand Down
42 changes: 12 additions & 30 deletions pyramid_georest/lib/description.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# -*- coding: iso-8859-1 -*-
# -*- coding: utf-8 -*-

# Copyright (c) 2012 - 2016, GIS-Fachstelle des Amtes für Geoinformation des Kantons Basel-Landschaft
# Copyright (c) 2012 - 2016, GIS-Fachstelle des Amtes f�r Geoinformation des Kantons Basel-Landschaft
# All rights reserved.
#
# This program is free software and completes the GeoMapFish License for the geoview.bl.ch specific
# parts of the code. You can redistribute it and/or modify it under the terms of the GNU General
# parts of the code. You can redistribute it and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
#
# The above copyright notice and this permission notice shall be included in all copies or substantial
# portions of the Software.
from sqlalchemy import ColumnDefault
Expand All @@ -26,8 +26,8 @@

def translate(string_to_translate, dictionary, lang='de'):
"""
A method which is able to translate a string with a given dictionary path on the file system. It acts in pyramid
way.
A method which is able to translate a string with a given dictionary path on the file system. It acts in
pyramid way.
See:
http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/i18n.html?highlight=translation
Expand Down Expand Up @@ -161,11 +161,8 @@ def __init__(self, column, name, dictionary=None):
def _column_fk(self):
"""
Helper function, if column has foreign key relation.
:param column: A SQLAlchemy column object
:type column: Column
:return: Tuple of first: has foreign key relation or not (true/false) and corresponding a list of them or None
:return: Tuple of first: has foreign key relation or not (true/false) and corresponding a list of
them or None
:rtype : (bool, list) or (bool, None)
"""
if self.column.foreign_keys:
Expand All @@ -181,10 +178,6 @@ def _column_fk(self):
def _column_length(self):
"""
Helper function, to obtain the lenght of the column which was provided (if type supports).
:param column: A SQLAlchemy column object
:type column: Column
:return: defined length for the passed column, None if so
:rtype : int
"""
Expand All @@ -197,10 +190,6 @@ def _column_length(self):
def _column_precision(self):
"""
Helper function, to obtain the precision of the column which was provided (if type supports).
:param column: A SQLAlchemy column object
:type column: Column
:return: defined precision for the passed column, None if so
:rtype : int
"""
Expand All @@ -213,10 +202,6 @@ def _column_precision(self):
def _column_scale(self):
"""
Helper function, to obtain the scale of the column which was provided (if type supports).
:param column: A SQLAlchemy column object
:type column: Column
:return: defined scale for the passed column, None if so
:rtype : int
"""
Expand All @@ -229,10 +214,6 @@ def _column_scale(self):
def _column_default(self):
"""
Helper function, to obtain the default value of the column which was provided (if type supports).
:param column: A SQLAlchemy column object
:type column: Column
:return: the value which was set as default for the passed column
:rtype : int or str
"""
Expand Down Expand Up @@ -302,8 +283,9 @@ def __init__(self, model, dictionary=None):

self.schema_name = self.model.__table__.schema
self.table_name = self.model.__table__.name

for name, value in class_mapper(self.model)._props.iteritems():
props = class_mapper(self.model)._props
for name in props:
value = props[name]
if type(value) is not RelationshipProperty:
if len(value.columns) != 1:
# print name, value.columns
Expand Down
Loading

0 comments on commit 838d881

Please sign in to comment.