Changeset 6097


Ignore:
Timestamp:
08/12/09 16:21:40 (10 years ago)
Author:
pnorton
Message:

Modified the catalog page so that it uses the dataset names rather than the csml file names. Copied and modified the catalog template form cows.

Location:
cowsserver/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • cowsserver/trunk

    • Property svn:ignore
      •  

        old new  
        33dist 
        44build 
         5log.txt 
  • cowsserver/trunk/lib/cowsserver/controllers/catalogue.py

    r6072 r6097  
    33import cowsserver.lib.base as base 
    44 
     5from cowsserver.lib.base import csTemplateLoader , globalCSMLConnector, c 
     6import operator 
     7 
     8 
    59log = logging.getLogger(__name__) 
    610 
    711class CatalogueController(base.BaseController): 
    8     """List available endpoints. 
     12    """ 
     13    List available endpoints. 
    914    """ 
    1015 
    1116    def index(self): 
    12         base.c.featureCollections = base.globalCSMLConnector.list() 
    1317         
    14         t = base.templateLoader.load('catalogue.xml') 
     18        c.allwxs=[] 
     19        c.wfsonly=[] 
     20 
     21        #need to handle wfs only features separately so sort into two lists 
     22        listwfsonly = list(globalCSMLConnector.listwfsonly()) 
    1523         
    16         return t.generate(c=base.c).render() 
     24        for fc in globalCSMLConnector.list(): 
     25            doc = globalCSMLConnector.getCsmlDoc(fc) 
     26             
     27            if hasattr(doc, 'name'): 
     28                fc_name = doc.name.CONTENT 
     29            else: 
     30                fc_name = fc 
     31             
     32            if fc in listwfsonly: 
     33                c.wfsonly.append((fc, fc_name) ) 
     34            else: 
     35                c.allwxs.append((fc, fc_name) ) 
     36         
     37         
     38        def sortCFByName(a, b): 
     39            return cmp(a[1].lower(), b[1].lower()) 
     40         
     41        c.allwxs.sort(cmp=sortCFByName) 
     42         
     43        c.wfsonly.sort(cmp=sortCFByName) 
     44                 
     45        t = csTemplateLoader.load('catalogue.xml') 
     46         
     47        return t.generate(c=c).render() 
  • cowsserver/trunk/lib/cowsserver/lib/base.py

    r6072 r6097  
    1919from pkg_resources import resource_filename 
    2020 
    21 ddcVisTemplateLoader = TemplateLoader( 
     21csTemplateLoader = TemplateLoader( 
    2222    resource_filename('cowsserver', 'templates'), 
    2323    auto_reload=True, 
Note: See TracChangeset for help on using the changeset viewer.