Package madrona :: Package staticmap :: Module temp_save
[hide private]

Source Code for Module madrona.staticmap.temp_save

 1  from views import draw_map 
 2   
 3  ''' 
 4  Create map image from a parameter dict 
 5  '''     
6 -def img_from_params(params, user=None):
7 opts = ['uids', 'width', 'height', 'autozoom', 'bbox', 'show_extent'] 8 9 class X: 10 pass
11 x = X() 12 13 for opt in opts: 14 try: 15 setattr(x,opt,params[opt]) 16 except: 17 setattr(x,opt,False) 18 19 try: 20 x.map_name = params[map_name] 21 except: 22 x.map_name = 'default' 23 24 # Note:: with user set to None, no perms checking happens 25 # so anything that calls this better make sure 26 # that request.user has permissions to view uids!! 27 img = draw_map(x.uids.split(','), user, int(x.width), int(x.height), x.autozoom, x.bbox, x.show_extent, x.map_name) 28 return img 29