本文整理汇总了Python中grano.model.Entity.author方法的典型用法代码示例。如果您正苦于以下问题:Python Entity.author方法的具体用法?Python Entity.author怎么用?Python Entity.author使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grano.model.Entity
的用法示例。
在下文中一共展示了Entity.author方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from grano.model import Entity [as 别名]
# 或者: from grano.model.Entity import author [as 别名]
def save(data, entity=None):
""" Save or update an entity. """
data = validate(data, entity)
operation = 'create' if entity is None else 'update'
if entity is None:
entity = Entity()
entity.project = data.get('project')
entity.author = data.get('author')
db.session.add(entity)
entity.schemata = list(set(data.get('schemata')))
prop_names = set()
for name, prop in data.get('properties').items():
prop_names.add(name)
prop['name'] = name
prop['author'] = data.get('author')
properties_logic.save(entity, prop)
for prop in entity.properties:
if prop.name not in prop_names:
prop.active = False
db.session.flush()
_entity_changed.delay(entity.id, operation)
return entity
示例2: save
# 需要导入模块: from grano.model import Entity [as 别名]
# 或者: from grano.model.Entity import author [as 别名]
def save(data, entity=None):
""" Save or update an entity. """
data = validate(data)
if entity is None:
entity = Entity()
entity.project = data.get('project')
entity.author = data.get('author')
db.session.add(entity)
entity.schemata = list(set(data.get('schemata')))
properties_logic.set_many(entity, data.get('author'),
data.get('properties'))
db.session.flush()
_entity_changed.delay(entity.id)
return entity