equal
deleted
inserted
replaced
|
1 import os.path |
|
2 |
|
3 def readFile (path) : |
|
4 fo = open(path, 'r') |
|
5 data = fo.read() |
|
6 fo.close() |
|
7 |
|
8 return data |
|
9 |
|
10 def readTitleDescr (path) : |
|
11 """ |
|
12 Read a title.txt or <imgname>.txt file |
|
13 """ |
|
14 |
|
15 if os.path.exists(path) : |
|
16 content = readFile(path) |
|
17 |
|
18 if '---' in content : |
|
19 title, descr = content.split('---', 1) |
|
20 else : |
|
21 title, descr = content, '' |
|
22 |
|
23 return title.strip(), descr.strip() |
|
24 |
|
25 return "", "" |
|
26 |
|
27 def url_join (*parts) : |
|
28 return '/'.join(parts) |
|
29 |
|
30 from optparse import OptionParser |
|
31 |
|
32 def optparse (options) : |
|
33 parser = OptionParser() |
|
34 |
|
35 |
|
36 parser.add_option |
|
37 |
|
38 |