Quote quote edge labels and strip leading and trailing whitespace from node and egde labels.

This commit is contained in:
Bastian Kleineidam 2010-11-06 15:36:21 +01:00
parent 2c93319a8e
commit e7dff74cf9
2 changed files with 6 additions and 3 deletions

View file

@ -8,6 +8,8 @@ Fixes:
Closes: SF bug #3096115
- logging: Avoid error when logger fields "intro" or "outro" are
configured.
- logging: Correctly quote graph edge labels and remove leading and
trailing whitespace from edge and node labels.
Changes:
- cmdline: Don't log a warning if URL has been redirected.

View file

@ -47,7 +47,7 @@ class GraphLogger (Logger):
"checktime": url_data.checktime,
"dlsize": url_data.dlsize,
"dltime": url_data.dltime,
"edge": url_data.name,
"edge": quote(url_data.name),
"valid": 1 if url_data.valid else 0,
}
self.nodes[node["url"]] = node
@ -85,5 +85,6 @@ class GraphLogger (Logger):
_disallowed = re.compile(r"[^a-zA-Z0-9 '#(){}\-\[\]\.,;:\!\?]+")
def quote (s):
"""Replace disallowed characters in node labels."""
return _disallowed.sub(" ", s)
"""Replace disallowed characters in node or edge labels.
Also remove whitespace from beginning or end of label."""
return _disallowed.sub(" ", s).strip()