equal
deleted
inserted
replaced
6 # of the GNU General Public License, incorporated herein by reference. |
6 # of the GNU General Public License, incorporated herein by reference. |
7 |
7 |
8 import re |
8 import re |
9 from demandload import demandload |
9 from demandload import demandload |
10 from i18n import gettext as _ |
10 from i18n import gettext as _ |
11 demandload(globals(), "cStringIO cgi os time urllib util") |
11 demandload(globals(), "cStringIO cgi sys os time urllib util") |
12 |
12 |
13 esctable = { |
13 esctable = { |
14 '\\': '\\', |
14 '\\': '\\', |
15 'r': '\r', |
15 'r': '\r', |
16 't': '\t', |
16 't': '\t', |
233 fl = f.split('/') |
233 fl = f.split('/') |
234 if name: fl.append(name) |
234 if name: fl.append(name) |
235 p = os.path.join(os.path.dirname(__file__), *fl) |
235 p = os.path.join(os.path.dirname(__file__), *fl) |
236 if (name and os.path.exists(p)) or os.path.isdir(p): |
236 if (name and os.path.exists(p)) or os.path.isdir(p): |
237 return os.path.normpath(p) |
237 return os.path.normpath(p) |
|
238 else: |
|
239 # executable version (py2exe) doesn't support __file__ |
|
240 if hasattr(sys, 'frozen'): |
|
241 return os.path.join(sys.prefix, "templates") |