def update_entity_by_id(self,entityId,name=None,parent=None,new_entityId=None): try: entity=self.get_entity(entityId) self.update_entity(entity,name=name,parent=parent,new_entityId=new_entityId) gc=GenericCache() gc.on_add_entity(entity.type.name) except Exception, e: raise e
def add_entity(self,name,entity_id,entityType,parent): try: type=DBHelper().find_by_name(EntityType,entityType) e=Entity() e.name=name e.type=type e.entity_id=entity_id #e.parent=parent DBHelper().add(e) DBHelper().add(EntityRelation(parent.entity_id,entity_id,u'Children')) ###Added to remove the referential integrity error due to transaction ###that SA/MySQL innodb is supposed to take care gc=GenericCache() gc.on_add_entity(e.type.name) DBSession.flush() except Exception, e: raise e