[core] add low-level retro-compatibility for attribute changes

First version of retrocompatibility, allowing to load files referencing removed or type-incompatible attributes.
* add node_factory to centralize node instantiation
* discard invalid attributes (i.e. not part of the node description anymore or with incompatible value type) when loading a file
* raise on unknown nodes
* add 'core.exception' module to declare Meshroom's exception types
This commit is contained in:
Yann Lanthony 2018-04-13 21:55:27 +02:00
parent f401ca7c8b
commit 0adc4d8cc6
3 changed files with 77 additions and 7 deletions

View file

@ -0,0 +1,22 @@
#!/usr/bin/env python
# coding:utf-8
class MeshroomException(Exception):
""" Base class for Meshroom exceptions """
pass
class GraphException(MeshroomException):
""" Base class for Graph exceptions """
pass
class UnknownNodeTypeError(GraphException):
"""
Raised when asked to create a unknown node type.
"""
def __init__(self, nodeType):
msg = "Unknown Node Type: " + nodeType
super(UnknownNodeTypeError, self).__init__(msg)
self.nodeType = nodeType