diff options
| author | Alon Levy <alon@pobox.com> | 2014-12-16 17:14:32 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-12-16 17:14:32 +0200 |
| commit | c7d026b1d504323a8c61d51b726e5e8d2337fc4b (patch) | |
| tree | 75607d07c90beb8024e34afd2bab3503dcaccda4 /src-py/model/model.py | |
| parent | dff765d765085fe2ee172abc606f4f8b25a39c27 (diff) | |
| parent | 38078c537f642806e4849dc99c07d679f816fe23 (diff) | |
Merging rhizi-server into rhizi, back to a single repo
Merge remote-tracking branch 'old-server/master' into wip/map-nodes-by-id_minimize-name-use
Diffstat (limited to 'src-py/model/model.py')
| -rw-r--r-- | src-py/model/model.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src-py/model/model.py b/src-py/model/model.py new file mode 100644 index 00000000..33cf9e6a --- /dev/null +++ b/src-py/model/model.py @@ -0,0 +1,37 @@ +class Link(): + """ + documentation anchor - this class currently carries no implementation + and only acts as a documentation anchor + + link['__src'] - meta attribute for link source object + link['__dst'] - meta attribute for link destination object + """ + + def __init__(self, src=None, dst=None): + assert False, 'currently unused' + + class Link_Ptr(dict): + """ + link['__src_id'] - meta attribute for link source id + link['__dst_id'] - meta attribute for link destination id + """ + def __init__(self, src_id=None, dst_id=None): + assert None != src_id or None != dst_id + + self['__src_id'] = src_id + self['__dst_id'] = dst_id + + @property + def src_id(self): + return self['__src_id'] + + @property + def dst_id(self): + return self['__dst_id'] + + @staticmethod + def link_ptr(src_id=None, dst_id=None): + """ + init from src_id or dst_id attributes - at least one must be provided + """ + return Link.Link_Ptr(src_id, dst_id) |
