From a67368cc5ad89fbb16bff01f3724093b64670a5f Mon Sep 17 00:00:00 2001 From: grindi Date: Mon, 10 Aug 2009 20:10:39 +0400 Subject: [PATCH] Added hh path normalization Slashes '/' in hh path can lead to import errors on non-posix systems Path normalization eliminates this problem --- pyfpdb/Configuration.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index b90040d7..f0277bca 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -74,11 +74,17 @@ class Layout: class Site: def __init__(self, node): + def normalizePath(path): + "Normalized existing pathes" + if os.path.exists(path): + return os.path.abspath(path) + return path + self.site_name = node.getAttribute("site_name") self.table_finder = node.getAttribute("table_finder") self.screen_name = node.getAttribute("screen_name") - self.site_path = node.getAttribute("site_path") - self.HH_path = node.getAttribute("HH_path") + self.site_path = normalizePath(node.getAttribute("site_path")) + self.HH_path = normalizePath(node.getAttribute("HH_path")) self.decoder = node.getAttribute("decoder") self.hudopacity = node.getAttribute("hudopacity") self.hudbgcolor = node.getAttribute("bgcolor") @@ -92,6 +98,8 @@ class Site: self.xpad = node.getAttribute("xpad") self.ypad = node.getAttribute("ypad") self.layout = {} + + print self.site_name, self.HH_path for layout_node in node.getElementsByTagName('layout'): lo = Layout(layout_node)