Skip to content

Commit

Permalink
Last minute fix: Handle absent directory for static files (not recogn…
Browse files Browse the repository at this point in the history
…ized by Git) and inform the user a little more about what's going on.
  • Loading branch information
Jochen Kupperschmidt committed Apr 2, 2012
1 parent 9d1db03 commit bcb4580
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gallerize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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.')
Expand Down

0 comments on commit bcb4580

Please sign in to comment.