Skip to content
Browse files

Last minute fix: Handle absent directory for static files (not recogn…

…ized by Git) and inform the user a little more about what's going on.
  • Loading branch information...
1 parent 9d1db03 commit bcb45807eeccfb1ebf4273c61820ef36429f154b @homeworkprod committed Apr 2, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 gallerize.py
View
7 gallerize.py
@@ -96,6 +96,8 @@ def link_images(self):
def generate(self):
# Create destination path if it doesn't exist.
if not os.path.exists(self.destination_path):
+ debug('Destination path "%s" does not exist, creating it.'
+ % self.destination_path)
os.mkdir(self.destination_path)
self.generate_images()
@@ -132,6 +134,11 @@ def render_html_index_page(self):
render_html_to_file('index', context, self.destination_path, 'index')
def copy_additional_static_files(self):
+ if not os.path.exists(PATH_STATIC):
+ debug('Path "%s", does not exist; not copying any static files.'
+ % PATH_STATIC)
+ return
+
filenames = list(sorted(os.listdir(PATH_STATIC)))
if not filenames:
debug('No static files to copy.')

0 comments on commit bcb4580

Please sign in to comment.
Something went wrong with that request. Please try again.