MCPcopy Create free account
hub / github.com/ActiveState/code / main

Function main

recipes/Python/578186_CGI_Image_Viewer/recipe-578186.py:11–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9image_extentions = '.bmp', '.gif', '.jpg', '.png'
10
11def main():
12 # Default Settings
13 title = 'Image Viewer'
14 image = ''
15 action = basename(argv[0])
16 back = ''
17 forward = ''
18 hidden = ''
19 if dictionary is None:
20 # Nothing To Do
21 pass
22 elif dictionary.had_key('directory'):
23 # Something To Do
24 if not dictionary.has_key('hidden'):
25 # Just Began Viewing
26 if isdir(dictionary['directory']):
27 # Check For Pickle
28 image_pickle = join(dictionary['directory'], 'image.pickle')
29 if exists(image_pickle):
30 # Load Directory Listing
31 dir_data = load(file(image_pickle))
32 else:
33 # Create Directory Listing
34 dir_data = update_image_pickle(dictionary['directory'])
35 # START HERE
36 image = WHAT_TO_DECIDE_HERE
37 else:
38 # Post Error Message
39 dictionary['directory'] = 'No Such Directory'
40 else:
41 # Find Next Image
42 show_form(title, image, action, back, forward, hidden)
43
44def show_form(*form_settings):
45 print_html(''&#x27;<html>

Callers

nothing calls this directly

Calls 5

isdirFunction · 0.85
show_formFunction · 0.70
joinFunction · 0.50
loadFunction · 0.50
has_keyMethod · 0.45

Tested by

no test coverage detected