Changeset 2629 for TI05-delivery


Ignore:
Timestamp:
21/06/07 09:51:16 (12 years ago)
Author:
spascoe
Message:

Added more logging. Requests are now logged and OWSExceptions are
logged as well as triggering an XML response. Requests to WMS/GetMap don't
trigger the debugger because it screws up openlayers.

Some changes to routes to make csml_api work again. No doubt this will change
when we have Exist plumbed in.

Location:
TI05-delivery/ows_framework/trunk/ows_server
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/development.ini

    r2615 r2629  
    1616port = 8080 
    1717 
    18 [app:main] 
     18[pipeline:main] 
     19pipeline = logger main_app 
     20 
     21[filter:logger] 
     22use = egg:Paste#translogger 
     23 
     24[app:main_app] 
    1925use = egg:ows_server 
    2026cache_dir = %(here)s/data 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/middleware.py

    r2616 r2629  
    1616from ows_server.config.ndgMiddleware import ndgMiddleware 
    1717 
    18 import logging 
     18# Logging doesn't need configuring if you have paste.translogger in your config file. 
     19#import logging 
    1920 
    2021def make_app(global_conf, full_stack=True, **app_conf): 
     
    5051    g=app.globals 
    5152     
    52  
    5353    # Configure logging 
    54     
    55     logging.basicConfig(format='%(thread)s %(name)s %(levelname)s %(message)s') 
     54    #logging.basicConfig(format='%(thread)s %(name)s %(levelname)s %(message)s') 
    5655     
    5756    # If errror handling and exception catching will be handled by middleware 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/routing.py

    r2626 r2629  
    3939    map.connect('view/:uri', controller = 'retrieve', action='view') 
    4040    map.connect('retrieve/:uri', controller = 'retrieve') 
    41     map.connect('csml/:uri', controller='csml_api') 
     41 
     42    # This route doesn't match the controller's parameters. 
     43    #map.connect('csml/:uri', controller='csml_api') 
     44    # Below is the way it worked before with added 
     45    # "csml" path component 
     46    map.connect('csml/:file.:format', controller='csml_api', action='index', 
     47                format='html') 
     48    map.connect('csml/:file/:(feature).:format', action='getFeature', 
     49                controller='csml_api', format='html') 
     50    map.connect('csml/:file/:feature/:action', controller='csml_api') 
     51 
    4252    map.connect('trackback/:uri', controller='trackback') 
    4353    map.connect('discovery',controller='discovery') 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wms.py

    r2599 r2629  
    2323 
    2424import cdms 
    25 import os 
     25import os, sys 
    2626from cStringIO import StringIO 
    2727import MA 
     
    137137            raise OWS_E.InvalidParameterValue('Layer not found', 'layers') 
    138138 
     139        # Clean up bbox.  Openlayers can request some very strange bboxes.  It is trimmed 
     140        # here and the implications for the image's aspect ratio is calculated in 
     141        # render.render_variable() 
     142        #!TODO: This could be done better. 
     143        x1 = max(-180., min(180., bbox[0])) 
     144        x2 = max(-180., min(180., bbox[2])) 
     145        y1 = max(-90., min(90., bbox[1])) 
     146        y2 = max(-90., min(90., bbox[3])) 
     147 
    139148        # Define the extraction selector 
    140         sel = dict(latitude=(bbox[1], bbox[3]), longitude=(bbox[0], bbox[2])) 
     149        sel = dict(latitude=(y1, y2), longitude=(x1, x2)) 
    141150 
    142151        # Parse dimensions. 
     
    150159            except KeyError: 
    151160                raise OWS_E.MissingParameterValue('%s dimension not specified' % dim, dim) 
     161 
     162         
    152163 
    153164        try: 
     
    166177            img.save(buf, 'PNG') 
    167178        except Exception, e: 
     179            import pdb; pdb.post_mortem(sys.exc_info()[2]) 
    168180            if isinstance(e, OWS_E.OwsError): 
    169181                raise e 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/render.py

    r2599 r2629  
    156156    # If a non-CRS:84 bbox is requested we must retrieve the valid 
    157157    # sub-bbox and paste it into an image of the correct size. 
    158     # It is assumed that grid can wrap around in the longitude and therefore only 
    159     # needs adjusting in the latitude. 
    160158    if bbox != bbox_obj.crs84: 
     159        logger.info('Padding image outside CRS:84 BBOX') 
     160        logger.info('Bbox: %s' % (bbox,)) 
     161        logger.info('Aspect ratio: %s, %s' % (width, height)) 
    161162        img = Image.new('RGBA', (width, height)) 
    162163        (ox, oy) = bbox_obj.getCrs84OffsetInImage(width, height) 
     164        logger.info('Offset in image: %s, %s' % (ox, oy)) 
    163165        nwidth, nheight = bbox_obj.getCrs84ImageSize(width, height) 
     166         
     167        logger.info('Inner image size: %s, %s' % (nwidth, nheight)) 
    164168        # If the image is too small just send a blank image 
    165169        if bbox_obj.crs84Width > abs(dlon) and bbox_obj.crs84Height > abs(dlat): 
    166             img1 = render(var, width, nheight) 
    167             img.paste(img1, (0, oy)) 
     170            img1 = render(var, nwidth, nheight) 
     171            img.paste(img1, (ox, oy)) 
    168172    else: 
    169173        img = render(var, width, height) 
  • TI05-delivery/ows_framework/trunk/ows_server/test.ini

    r2594 r2629  
    1616 
    1717[app:main] 
    18 use = config:development.ini 
     18use = config:development.ini#main_app 
    1919csml_dir = %(here)s/ows_server/tests/data 
    2020 
Note: See TracChangeset for help on using the changeset viewer.