Changeset 2921

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

Show some information about each extent

Files:

Legend:

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

    r2920 r2921  
    5252        pass 
    5353     
    54     def show(self, id, format='html'): 
     54    def show(self, db_id, id, format='html'): 
    5555        """GET /id: Show a specific item.""" 
    5656        # url_for('extent', id=ID) 
    57         pass 
     57        db = self.dbs[db_id] 
     58        c.db_label = label(db) 
     59        c.db_url = h.url_for('database', id=db_id) 
     60        extent = db.extent(id) 
     61        c.extent_label = label(extent) 
     62        c.extent_plural = plural(extent) 
     63        c.extent_len = len(extent) 
     64        c.extent_name = extent.name 
     65        c.transactions = transactions = [] 
     66        for tx_name in list(extent.t): 
     67            tx_url = '#'        # XXX: make real 
     68            tx_method = extent.t[tx_name] 
     69            tx_label = label(tx_method) 
     70            transactions.append((tx_label, tx_url)) 
     71        return render_response('extents.show') 
    5872     
    5973    def edit(self, id, format='html'): 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/tests/functional/test_extents.py

    r2916 r2921  
    11from schevopylonsnav.tests import * 
     2 
    23 
    34class TestExtentsController(TestController): 
     
    78        assert 'Foo' in response 
    89        assert url_for('extent', db_id='db', id='Foo') in response 
     10 
     11    def test_show(self): 
     12        response = self.app.get(url_for('extent', db_id='db', id='Foo')) 
     13        assert 'Foo' in response        # extent name and singular label 
     14        assert 'Foos' in response       # plural label 
     15        assert '0' in response          # length 
     16        assert 'Transaction Methods' in response 
     17        assert 'Create' in response 
     18        # XXX: test transaction URL