Show More
@@ -292,13 +292,14 b' common_filters = {' | |||||
292 | def templatepath(name=None): |
|
292 | def templatepath(name=None): | |
293 | '''return location of template file or directory (if no name). |
|
293 | '''return location of template file or directory (if no name). | |
294 | returns None if not found.''' |
|
294 | returns None if not found.''' | |
|
295 | # executable version (py2exe) doesn't support __file__ | |||
|
296 | if hasattr(sys, 'frozen'): | |||
|
297 | module = sys.executable | |||
|
298 | else: | |||
|
299 | module = __file__ | |||
295 | for f in 'templates', '../templates': |
|
300 | for f in 'templates', '../templates': | |
296 | fl = f.split('/') |
|
301 | fl = f.split('/') | |
297 | if name: fl.append(name) |
|
302 | if name: fl.append(name) | |
298 |
p = os.path.join(os.path.dirname( |
|
303 | p = os.path.join(os.path.dirname(module), *fl) | |
299 | if (name and os.path.exists(p)) or os.path.isdir(p): |
|
304 | if (name and os.path.exists(p)) or os.path.isdir(p): | |
300 | return os.path.normpath(p) |
|
305 | return os.path.normpath(p) | |
301 | else: |
|
|||
302 | # executable version (py2exe) doesn't support __file__ |
|
|||
303 | if hasattr(sys, 'frozen'): |
|
|||
304 | return os.path.join(sys.prefix, "templates") |
|
General Comments 0
You need to be logged in to leave comments.
Login now