aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Harvey <chris@basementcode.com>2010-06-01 08:35:13 -0400
committerChristopher Harvey <chris@basementcode.com>2010-06-01 08:35:13 -0400
commit8c11d0e0cfd31a269a41ce0c4800b4c2d727a9e5 (patch)
tree152e33db9b9931cd808c30b1728b338f4b20f1bf
parentMoved project into official GSoC hosting from github. (diff)
downloadventoo-8c11d0e0cfd31a269a41ce0c4800b4c2d727a9e5.tar.gz
ventoo-8c11d0e0cfd31a269a41ce0c4800b4c2d727a9e5.tar.bz2
ventoo-8c11d0e0cfd31a269a41ce0c4800b4c2d727a9e5.zip
Documentation files are now located relative to the module root directory.
-rw-r--r--modules/hosts/ipaddr.html3
-rw-r--r--modules/hosts/main.xml2
-rw-r--r--src/backend/VentooModule.py9
3 files changed, 10 insertions, 4 deletions
diff --git a/modules/hosts/ipaddr.html b/modules/hosts/ipaddr.html
new file mode 100644
index 0000000..56cf442
--- /dev/null
+++ b/modules/hosts/ipaddr.html
@@ -0,0 +1,3 @@
+<html>
+ docroot works!
+<html>
diff --git a/modules/hosts/main.xml b/modules/hosts/main.xml
index 863d3f8..4b17844 100644
--- a/modules/hosts/main.xml
+++ b/modules/hosts/main.xml
@@ -1,6 +1,6 @@
<VentooModule>
<root mult="*">
- <ipaddr mult="1"/>
+ <ipaddr mult="1" docurl="ipaddr.html"/>
<canonical mult="1"/>
<alias mult="*"/>
</root>
diff --git a/src/backend/VentooModule.py b/src/backend/VentooModule.py
index 77a81ea..ff2af32 100644
--- a/src/backend/VentooModule.py
+++ b/src/backend/VentooModule.py
@@ -21,6 +21,7 @@
import os.path as osp
from lxml import etree
+import augeas_utils
_ventoo_search_paths_ = ['../modules', '../../modules']
@@ -33,6 +34,7 @@ class VentooModule:
if osp.isfile(thisPath):
self.pathFound = thisPath
found = True
+ self.docRoot = osp.join(p, moduleName)
break
if not found:
raise RuntimeError('Could not find '+moduleName+' Module')
@@ -59,11 +61,12 @@ class VentooModule:
else:
return '0'
- def getDocURLOf(self, xPath):
+ def getDocURLOf(self, xPath):
try:
elem = self.xmlTree.xpath(osp.join(xPath))
- if len(elem) >= 1:
- return elem[0].get("docurl")
+ if len(elem) >= 1 and not elem[0].get("docurl") == None:
+ #pdb.set_trace()
+ return "file:///"+osp.abspath(osp.join(self.docRoot, augeas_utils.stripBothSlashes(elem[0].get("docurl"))))
except etree.XPathEvalError:
pass
return None