Changeset 2920

Show
Ignore:
Timestamp:
02/20/07 18:33:54 (2 years ago)
Author:
mscott
Message:

Expose more links to resources; add a show resource for individual databases.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/databases.py

    r2918 r2920  
    1414        # url_for('databases') 
    1515        dbs = self.dbs 
     16        c.dbs_url = h.url_for('databases') 
    1617        c.databases = databases = [] 
    1718        for db_name, db in dbs.iteritems(): 
     
    5253        """GET /id: Show a specific item.""" 
    5354        # url_for('database', id=ID) 
    54         pass 
     55        db = self.dbs[id] 
     56        c.db_label = label(db) 
     57        c.db_url = h.url_for('database', id=id) 
     58        c.dbs_url = h.url_for('databases') 
     59        c.extents_url = h.url_for('extents', db_id=id) 
     60        return render_response('databases.show') 
    5561     
    5662    def edit(self, id, format='html'): 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extents.py

    r2919 r2920  
    1616        c.db_label = label(db) 
    1717        c.db_url = h.url_for('database', id=db_id) 
     18        c.extents_url = h.url_for('extents', db_id=db_id) 
    1819        c.extents = extents = [] 
    1920        for extent in db.extents(): 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/databases/index.html

    r2918 r2920  
    88    </head> 
    99    <body> 
    10                 <h1>Databases</h1> 
     10                <h1><a href="${c.dbs_url}">Databases</a></h1> 
    1111                 
    1212                <ul> 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extents/index.html

    r2919 r2920  
    88    </head> 
    99    <body> 
    10                 <h1>Extents in <a href="${c.db_url}">${c.db_label}</a></h1> 
     10                <h1><a href="${c.extents_url}">Extents</a>  
     11                        in <a href="${c.db_url}">${c.db_label}</a></h1> 
    1112                 
    1213                <ul> 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_databases.py

    r2919 r2920  
    88        assert 'db' in response 
    99        assert url_for('database', id='db') in response 
     10 
     11    def test_show(self): 
     12        response = self.app.get(url_for('database', id='db')) 
     13        assert 'db' in response 
     14        assert url_for('database', id='db') in response 
     15        assert url_for('databases') in response 
     16        assert 'Extents' in response 
     17        assert url_for('extents', db_id='db') in response