Example #1
0
        'polymorphic_identity': BOOK_TYPE,
        'inherit_condition': ArchiveDocument.id == id
    }

    __table_args__ = Base.__table_args__

schema_book_locale = schema_document_locale
schema_book_attributes = list(schema_attributes)
schema_book_attributes.remove('geometry')

schema_book = SQLAlchemySchemaNode(
    Book,
    # whitelisted attributes
    includes=schema_book_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_book_locale]
        },
    })

schema_create_book = get_create_schema(schema_book)
schema_update_book = get_update_schema(schema_book)
schema_listing_book = restrict_schema(
    schema_book, fields_book.get('listing'))
Example #2
0
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_image_locale]
        },
        'geometry': geometry_schema_overrides
    })

schema_create_image = get_create_schema(schema_image)
schema_update_image = get_update_schema(schema_image)
schema_listing_image = restrict_schema(
    schema_image, fields_image.get('listing'))
schema_association_image = restrict_schema(schema_image, [
    'filename', 'locales.title', 'geometry.geom'
])


class SchemaImageList(MappingSchema):
    images = SchemaNode(
        Sequence(), schema_create_image, missing=None)
schema_create_image_list = SchemaImageList()


def is_personal(image_id):
Example #3
0
    __mapper_args__ = {
        'polymorphic_identity': AREA_TYPE,
        'inherit_condition': ArchiveDocument.id == id
    }

    __table_args__ = Base.__table_args__


schema_area = SQLAlchemySchemaNode(
    Area,
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_document_locale]
        },
        'geometry': get_geometry_schema_overrides(['POLYGON', 'MULTIPOLYGON'])
    })

schema_create_area = get_create_schema(schema_area)
schema_update_area = get_update_schema(schema_area)
schema_listing_area = restrict_schema(
    schema_area, fields_area.get('listing'))
Example #4
0
            'missing': None
        },
        'locales': {
            'children': [schema_xreport_locale],
        },
        'activities': {
            'validator': colander.Length(min=1)
        },
        'geometry': geometry_schema_overrides
    })

# schema that hides personal information of a xreport
schema_xreport_without_personal = SQLAlchemySchemaNode(
    Xreport,
    # whitelisted attributes
    includes=schema_attributes + attributes_without_personal,
    overrides={
        'locales': {
            'children': [schema_xreport_locale],
        },
        'geometry': geometry_schema_overrides
    })


schema_create_xreport = get_create_schema(schema_xreport)
schema_update_xreport = get_update_schema(schema_xreport)
schema_listing_xreport = restrict_schema(
    schema_xreport,
    fields_xreport.get('listing')
)
Example #5
0
        'version': {
            'missing': None
        }
    })

schema_outing = SQLAlchemySchemaNode(
    Outing,
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_outing_locale]
        },
        'activities': {
            'validator': colander.Length(min=1)
        },
        'geometry': geometry_schema_overrides
    })

schema_create_outing = get_create_schema(schema_outing)
schema_update_outing = get_update_schema(schema_outing)
schema_association_outing = restrict_schema(schema_outing, [
    'locales.title', 'activities', 'date_start', 'date_end'
])
Example #6
0
    includes=schema_locale_attributes + attributes_locales,
    overrides={
        'version': {
            'missing': None
        }
    })


schema_waypoint = SQLAlchemySchemaNode(
    Waypoint,
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_waypoint_locale]
        },
        'geometry': geometry_schema_overrides
    })

schema_create_waypoint = get_create_schema(schema_waypoint)
schema_update_waypoint = get_update_schema(schema_waypoint)
schema_association_waypoint = restrict_schema(schema_waypoint, [
    'elevation', 'locales.title'
])
Example #7
0

class ArchiveArea(_AreaMixin, ArchiveDocument):
    """
    """

    __tablename__ = "areas_archives"

    id = Column(Integer, ForeignKey(schema + ".documents_archives.id"), primary_key=True)

    __mapper_args__ = {"polymorphic_identity": AREA_TYPE, "inherit_condition": ArchiveDocument.id == id}

    __table_args__ = Base.__table_args__


schema_area = SQLAlchemySchemaNode(
    Area,
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        "document_id": {"missing": None},
        "version": {"missing": None},
        "locales": {"children": [schema_document_locale]},
        "geometry": geometry_schema_overrides,
    },
)

schema_create_area = get_create_schema(schema_area)
schema_update_area = get_update_schema(schema_area)
schema_listing_area = restrict_schema(schema_area, fields_area.get("listing"))
Example #8
0
    includes=schema_locale_attributes + attributes_locales,
    overrides={'version': {
        'missing': None
    }})

schema_outing = SQLAlchemySchemaNode(
    Outing,
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_outing_locale]
        },
        'activities': {
            'validator': colander.Length(min=1)
        },
        'geometry':
        get_geometry_schema_overrides(['LINESTRING', 'MULTILINESTRING'])
    })

schema_create_outing = get_create_schema(schema_outing)
schema_update_outing = get_update_schema(schema_outing)
schema_association_outing = restrict_schema(
    schema_outing, ['locales.title', 'activities', 'date_start', 'date_end'])
Example #9
0
    Route,
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_route_locale]
        },
        'activities': {
            'validator': colander.Length(min=1)
        },
        'geometry': get_geometry_schema_overrides(
            ['LINESTRING', 'MULTILINESTRING'])
    })

schema_create_route = get_create_schema(schema_route)
schema_update_route = get_update_schema(schema_route)
schema_association_route = restrict_schema(schema_route, [
    'locales.title', 'locales.title_prefix', 'elevation_min', 'elevation_max',
    'activities'
])
schema_association_waypoint_route = restrict_schema(schema_route, [
    'locales.title', 'locales.title_prefix', 'elevation_min', 'elevation_max',
    'activities', 'geometry.geom_detail'
])
Example #10
0
schema_article_attributes.remove('geometry')

schema_article = SQLAlchemySchemaNode(
    Article,
    # whitelisted attributes
    includes=schema_article_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_article_locale]
        },
    })

schema_create_article = get_create_schema(schema_article)
schema_update_article = get_update_schema(schema_article)
schema_listing_article = restrict_schema(
    schema_article, fields_article.get('listing'))


def is_personal(article_id):
    article_type = DBSession.query(Article.article_type). \
        select_from(Article.__table__). \
        filter(Article.document_id == article_id). \
        scalar()
    return article_type == 'personal'
Example #11
0
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_xreport_locale],
        },
        'geometry': get_geometry_schema_overrides(['POINT'])
    })

# schema that hides personal information of a xreport
schema_xreport_without_personal = SQLAlchemySchemaNode(
    Xreport,
    # whitelisted attributes
    includes=schema_attributes + attributes_without_personal,
    overrides={
        'locales': {
            'children': [schema_xreport_locale],
        },
        'geometry': get_geometry_schema_overrides(['POINT'])
    })

schema_create_xreport = get_create_schema(schema_xreport)
schema_update_xreport = get_update_schema(schema_xreport)
schema_listing_xreport = restrict_schema(schema_xreport,
                                         fields_xreport.get('listing'))
Example #12
0
        'inherit_condition': ArchiveDocument.id == id
    }

    __table_args__ = Base.__table_args__


schema_book_locale = schema_document_locale
schema_book_attributes = list(schema_attributes)
schema_book_attributes.remove('geometry')

schema_book = SQLAlchemySchemaNode(
    Book,
    # whitelisted attributes
    includes=schema_book_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_book_locale]
        },
    })

schema_create_book = get_create_schema(schema_book)
schema_update_book = get_update_schema(schema_book)
schema_listing_book = restrict_schema(
    schema_book, fields_book.get('listing'))
Example #13
0
schema_waypoint_locale = SQLAlchemySchemaNode(
    WaypointLocale,
    # whitelisted attributes
    includes=schema_locale_attributes + attributes_locales,
    overrides={'version': {
        'missing': None
    }})

schema_waypoint = SQLAlchemySchemaNode(
    Waypoint,
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_waypoint_locale]
        },
        'geometry': get_geometry_schema_overrides(['POINT'])
    })

schema_create_waypoint = get_create_schema(schema_waypoint)
schema_update_waypoint = get_update_schema(schema_waypoint)
schema_association_waypoint = restrict_schema(
    schema_waypoint, ['elevation', 'locales.title', 'geometry.geom'])
Example #14
0
schema_route = SQLAlchemySchemaNode(
    Route,
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_route_locale]
        },
        'activities': {
            'validator': colander.Length(min=1)
        },
        'geometry': geometry_schema_overrides
    })

schema_create_route = get_create_schema(schema_route)
schema_update_route = get_update_schema(schema_route)
schema_association_route = restrict_schema(schema_route, [
    'locales.title', 'locales.title_prefix', 'elevation_min', 'elevation_max',
    'activities'
])
schema_association_waypoint_route = restrict_schema(schema_route, [
    'locales.title', 'locales.title_prefix', 'elevation_min', 'elevation_max',
    'activities', 'geometry.geom_detail'
])
Example #15
0
    # whitelisted attributes
    includes=schema_attributes + attributes,
    overrides={
        'document_id': {
            'missing': None
        },
        'version': {
            'missing': None
        },
        'locales': {
            'children': [schema_image_locale]
        },
        'geometry': get_geometry_schema_overrides(['POINT'])
    })

schema_create_image = get_create_schema(schema_image)
schema_update_image = get_update_schema(schema_image)
schema_listing_image = restrict_schema(schema_image,
                                       fields_image.get('listing'))
schema_association_image = restrict_schema(
    schema_image, ['filename', 'locales.title', 'geometry.geom'])


class SchemaImageList(MappingSchema):
    images = SchemaNode(Sequence(), schema_create_image, missing=None)


schema_create_image_list = SchemaImageList()


def is_personal(image_id):