comparison 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
comparison
equal deleted inserted replaced
35:e4c345dcf33c 36:485682a6de50
6 def __init__(self, root=None): 6 def __init__(self, root=None):
7 if not root: 7 if not root:
8 root = os.getcwd() 8 root = os.getcwd()
9 Exception.__init__(self, 9 Exception.__init__(self,
10 "No PieCrust website in '%s' " 10 "No PieCrust website in '%s' "
11 "('_content/config.yml' not found!)." % root) 11 "('config.yml' not found!)." % root)
12 12
13 13
14 def find_app_root(cwd=None): 14 def find_app_root(cwd=None):
15 if cwd is None: 15 if cwd is None:
16 cwd = os.getcwd() 16 cwd = os.getcwd()
17 17
18 while not os.path.isfile(os.path.join(cwd, '_content', 'config.yml')): 18 while not os.path.isfile(os.path.join(cwd, 'config.yml')):
19 cwd = os.path.dirname(cwd) 19 cwd = os.path.dirname(cwd)
20 if not cwd or cwd == '/': 20 if not cwd or cwd == '/':
21 return None 21 return None
22 return cwd 22 return cwd
23 23