lib/utils.py
changeset 12 c2d8e9a754a1
child 14 4b5478da5850
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/utils.py	Fri Dec 21 20:36:03 2007 +0000
@@ -0,0 +1,38 @@
+import os.path
+
+def readFile (path) :
+    fo = open(path, 'r')
+    data = fo.read()
+    fo.close()
+
+    return data
+
+def readTitleDescr (path) :
+    """
+        Read a title.txt or <imgname>.txt file
+    """
+
+    if os.path.exists(path) :
+        content = readFile(path)
+
+        if '---' in content :
+            title, descr = content.split('---', 1)
+        else :
+            title, descr = content, ''
+
+        return title.strip(), descr.strip()
+
+    return "", ""
+
+def url_join (*parts) :
+    return '/'.join(parts)
+ 
+from optparse import OptionParser
+    
+def optparse (options) :
+    parser = OptionParser()
+    
+    
+    parser.add_option    
+    
+    
\ No newline at end of file