summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-09-26 15:19:49 +0200
committerJan Pokorný <jpokorny@redhat.com>2013-09-26 15:19:49 +0200
commit0c709b2bab6e4d65d55542ef9d9986f72bb7fb95 (patch)
tree279b06f0e89e034f182c3e950eefea9d5b0c301c
parentd304639d6fb81be40da18fd0d8165e85294da3a9 (diff)
downloadcluster-overview-0c709b2bab6e4d65d55542ef9d9986f72bb7fb95.zip
cluster-overview-0c709b2bab6e4d65d55542ef9d9986f72bb7fb95.tar.gz
cluster-overview-0c709b2bab6e4d65d55542ef9d9986f72bb7fb95.tar.xz
Lib: when generating static format, promote url (from 'web' attr)
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--lib.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib.py b/lib.py
index 18e57e4..adfdf9c 100644
--- a/lib.py
+++ b/lib.py
@@ -43,6 +43,8 @@ def bl_map_nodes_edges(nodes, edges, prev_nnames=None):
class LibMeta(type):
+ promote_url = False
+
def __new__(cls, name, bases, attrs):
ret = super(LibMeta, cls).__new__(cls, name, bases, attrs)
if REGISTRY.setdefault(name, ret) is not ret:
@@ -66,7 +68,11 @@ class LibMeta(type):
for akey, avalue in getattr(cls, 'defaults', {}).iteritems():
kwargs.setdefault(akey, avalue)
- kwargs['URL'] = "class://" + self.__class__.__name__
+ if type(self).promote_url:
+ if hasattr(self, 'web'):
+ kwargs['URL'] = getattr(self, 'web', None)
+ else:
+ kwargs['URL'] = "class://" + self.__class__.__name__
old_init(self, *args, **kwargs)
super(cls, self).__init__(*args, **kwargs)
@@ -316,6 +322,7 @@ def main(graph, argv, *args, **kws):
if x:
xdot_graph(graph, **kws)
else:
+ LibMeta.promote_url = True
ext = argv[1] if len(argv) > 1 else 'pdf'
fmt = {'dot': 'raw'}.get(ext, ext)
output += extsep + ext