Python sqlalchemy.orm.mapper.iterate_properties() Examples

The following are code examples for showing how to use sqlalchemy.orm.mapper.iterate_properties(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: flasky   Author: RoseOu   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 2
Project: Flask_Blog   Author: sugarguo   File: mutable.py    GNU General Public License v3.0 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 3
Project: jbox   Author: jpush   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 4
Project: Mahjong-Solitaire   Author: MEASHY   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 5
Project: Mahjong-Solitaire   Author: MEASHY   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 6
Project: oa_qian   Author: sunqb   File: mutable.py    Apache License 2.0 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 7
Project: analyzePF   Author: analyzeDFIR   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 8
Project: xuemc   Author: skycucumber   File: mutable.py    GNU General Public License v2.0 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 9
Project: chihu   Author: yelongyu   File: mutable.py    GNU General Public License v3.0 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 10
Project: url_shortener   Author: martydill   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 11
Project: DevFest-MaxBond   Author: aiyyoi   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 12
Project: myBlog   Author: adxc   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 13
Project: planespotter   Author: yfauser   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 14
Project: WRGameVideos-API   Author: thundernet8   File: mutable.py    GNU General Public License v2.0 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 15
Project: pipa-pay-server   Author: davidvon   File: mutable.py    Apache License 2.0 5 votes vote down vote up
def _setup_composite_listener():
    import types
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and (type(prop.composite_class) in (types.ClassType, types.TypeType)) and
                issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not Mapper.dispatch.mapper_configured._contains(Mapper, _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 16
Project: Light_control   Author: laurent-colas   File: mutable.py    The Unlicense 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 17
Project: plataforma-livre-dados-abertos   Author: pbaesse   File: mutable.py    GNU General Public License v3.0 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (
                hasattr(prop, "composite_class")
                and isinstance(prop.composite_class, type)
                and issubclass(prop.composite_class, MutableComposite)
            ):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_
                )

    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, "mapper_configured", _listen_for_type) 
Example 18
Project: Ridr_app   Author: RydrDojo   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 19
Project: webapp   Author: superchilli   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 20
Project: my_hass_config   Author: ivencooli   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 21
Project: Full-Stack-Application-Development   Author: Bolton-and-Menk-GIS   File: mutable.py    GNU General Public License v3.0 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type) 
Example 22
Project: sqlalchemy   Author: sqlalchemy   File: mutable.py    MIT License 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (
                hasattr(prop, "composite_class")
                and isinstance(prop.composite_class, type)
                and issubclass(prop.composite_class, MutableComposite)
            ):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_
                )

    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, "mapper_configured", _listen_for_type) 
Example 23
Project: WRGameVideos-Server   Author: thundernet8   File: mutable.py    GNU General Public License v2.0 5 votes vote down vote up
def _setup_composite_listener():
    def _listen_for_type(mapper, class_):
        for prop in mapper.iterate_properties:
            if (hasattr(prop, 'composite_class') and
                    isinstance(prop.composite_class, type) and
                    issubclass(prop.composite_class, MutableComposite)):
                prop.composite_class._listen_on_attribute(
                    getattr(class_, prop.key), False, class_)
    if not event.contains(Mapper, "mapper_configured", _listen_for_type):
        event.listen(Mapper, 'mapper_configured', _listen_for_type)