comparison decoupage/web.py @ 76:1892ac35e9c8

???
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 15 Apr 2013 23:30:39 -0700
parents 7db9d9b82a06
children 5330cd62e179
comparison
equal deleted inserted replaced
75:7db9d9b82a06 76:1892ac35e9c8
241 for i in filenames: 241 for i in filenames:
242 filepath = os.path.join(directory, i) 242 filepath = os.path.join(directory, i)
243 filetype = 'file' 243 filetype = 'file'
244 if os.path.isdir(filepath): 244 if os.path.isdir(filepath):
245 filetype = 'directory' 245 filetype = 'directory'
246 modified = os.path.getmtime(filepath) 246 try:
247 modified = os.path.getmtime(filepath)
248 except OSError:
249 # the file (mysteriously) may not exist by this time(!)
250 # File "/home/jhammel/web/src/decoupage/decoupage/web.py", line 114, in __call__
251 # res = self.get(request)
252 # File "/home/jhammel/web/src/decoupage/decoupage/web.py", line 162, in get
253 # files = self.filedata(path, directory, conf)
254 # File "/home/jhammel/web/src/decoupage/decoupage/web.py", line 246, in filedata
255 # modified = os.path.getmtime(filepath)
256 # File "/home/jhammel/web/lib/python2.6/genericpath.py", line 54, in getmtime
257 # return os.stat(filename).st_mtime
258 # OSError: [Errno 2] No such file or directory: '/home/jhammel/web/site/portfolio/ideas/.#index.ini'
259 continue # wt{h,f}???
260
247 modified = datetime.fromtimestamp(modified) 261 modified = datetime.fromtimestamp(modified)
248 data = {'path' : '%s/%s' % (path.rstrip('/'), i), 262 data = {'path' : '%s/%s' % (path.rstrip('/'), i),
249 'name': i, 263 'name': i,
250 'modified': modified, 264 'modified': modified,
251 'type': filetype} 265 'type': filetype}