当前位置: 首页>>代码示例>>Python>>正文


Python Entity._filter_property方法代码示例

本文整理汇总了Python中grano.model.Entity._filter_property方法的典型用法代码示例。如果您正苦于以下问题:Python Entity._filter_property方法的具体用法?Python Entity._filter_property怎么用?Python Entity._filter_property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grano.model.Entity的用法示例。


在下文中一共展示了Entity._filter_property方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save

# 需要导入模块: from grano.model import Entity [as 别名]
# 或者: from grano.model.Entity import _filter_property [as 别名]
    def save(self):
        """ Save the entity to the database. Do this only once, after all
        properties have been set. """

        # fetch existing:
        q = Entity.all()
        q = q.filter(Entity.project==self.loader.project)
        for name, only_active in self.update_criteria:
            value = self.properties.get(name).get('value')
            attr = self.loader.project.get_attribute('entity', name)
            q = Entity._filter_property(q, [attr], value,
                only_active=only_active)

        entity = q.first()

        try:
            data = {
                'project': self.loader.project,
                'author': self.loader.account,
                'schemata': self.schemata,
                'properties': self.properties
            }
            self._entity = entities.save(data, entity=entity)

        except Invalid, inv:
            log.warning("Validation error: %r", inv)
开发者ID:nimblemachine,项目名称:grano,代码行数:28,代码来源:loader.py

示例2: save

# 需要导入模块: from grano.model import Entity [as 别名]
# 或者: from grano.model.Entity import _filter_property [as 别名]
    def save(self):
        """ Save the relation to the database. Do this only once, after all
        properties have been set. """

        # fetch existing:
        q = Relation.all()
        q = q.filter(Relation.project==self.loader.project)
        q = q.filter(Relation.source==self.source.entity)
        q = q.filter(Relation.target==self.target.entity)

        for name, only_active in self.update_criteria:
            value = self.properties.get(name).get('value')
            q = Entity._filter_property(q, name, value,
                only_active=only_active)
        relation = q.first()

        try:
            data = {
                'project': self.loader.project,
                'author': self.loader.account,
                'schema': self.schemata.pop(),
                'properties': self.properties,
                'source': self.source.entity,
                'target': self.target.entity
            }
            self._relation = relations.save(data, relation=relation)
        except Invalid, inv:
            log.warning("Validation error: %r", inv)
开发者ID:eocaollai,项目名称:grano,代码行数:30,代码来源:loader.py

示例3: save

# 需要导入模块: from grano.model import Entity [as 别名]
# 或者: from grano.model.Entity import _filter_property [as 别名]
    def save(self):
        """ Save the entity to the database. Do this only once, after all
        properties have been set. """
        # fetch existing:
        q = Entity.all()
        q = q.filter(Entity.project == self.loader.project)
        for name, only_active in self.update_criteria:
            v = self.properties.get(name).get('value')
            q = Entity._filter_property(q, name, v, only_active=only_active)
        entity = q.first()

        try:
            data = {
                'project': self.loader.project,
                'author': self.loader.account,
                'schema': self.schema,
                'properties': self.properties
            }
            self._entity = entities.save(data, entity=entity)

        except Invalid, inv:
            if not self.loader.ignore_errors:
                raise
            log.warning("Validation error: %r", inv.asdict())
开发者ID:01-,项目名称:grano,代码行数:26,代码来源:loader.py


注:本文中的grano.model.Entity._filter_property方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。