Mercurial > piecrust2
annotate piecrust/pathutil.py @ 36:485682a6de50
New site layout support.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 20 Aug 2014 23:16:51 -0700 |
parents | aaa8fb7c8918 |
children | 091f99bfbe44 |
rev | line source |
---|---|
0 | 1 import os |
2 import os.path | |
3 | |
4 | |
5 class SiteNotFoundError(Exception): | |
6 def __init__(self, root=None): | |
7 if not root: | |
8 root = os.getcwd() | |
9 Exception.__init__(self, | |
10 "No PieCrust website in '%s' " | |
36
485682a6de50
New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
11 "('config.yml' not found!)." % root) |
0 | 12 |
13 | |
14 def find_app_root(cwd=None): | |
15 if cwd is None: | |
16 cwd = os.getcwd() | |
17 | |
36
485682a6de50
New site layout support.
Ludovic Chabant <ludovic@chabant.com>
parents:
1
diff
changeset
|
18 while not os.path.isfile(os.path.join(cwd, 'config.yml')): |
0 | 19 cwd = os.path.dirname(cwd) |
1
aaa8fb7c8918
Re-arranged modules to reduce dependencies to builtin stuff.
Ludovic Chabant <ludovic@chabant.com>
parents:
0
diff
changeset
|
20 if not cwd or cwd == '/': |
0 | 21 return None |
22 return cwd | |
23 |