Changeset 2974

Show
Ignore:
Timestamp:
02/24/07 22:21:47 (2 years ago)
Author:
mscott
Message:

allow use of t methods of entities

Files:

Legend:

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

    r2973 r2974  
    1717        c.entity = extent[int(entity_id)] 
    1818        return render_response('/entity_t_methods/index.html') 
     19     
     20    def call(self, db_id, extent_id, entity_id, id): 
     21        """POST /id;call: Call the transaction method.""" 
     22        # url_for('extent_call_t_method', id=ID) 
     23        db = self.dbs[db_id] 
     24        extent = db.extent(extent_id) 
     25        entity = extent[int(entity_id)] 
     26        method = entity.t[id] 
     27        tx = method() 
     28        tx_cache = g.tx_cache 
     29        token = g.new_cache_token(tx_cache) 
     30        tx_cache[token] = tx 
     31        return redirect_to(h.url_for('transaction', db_id=db_id, id=token)) 
    1932     
    2033    def create(self): 
     
    4659        pass 
    4760     
    48     def show(self, id, format='html'): 
     61    def show(self, db_id, extent_id, entity_id, id, format='html'): 
    4962        """GET /id: Show a specific item.""" 
    5063        # url_for('entity_t_method', id=ID) 
    51         pass 
     64        c.dbs = dbs = self.dbs 
     65        c.db_id = db_id 
     66        c.db = db = dbs[db_id] 
     67        c.extent = extent = db.extent(extent_id) 
     68        c.entity = entity = extent[int(entity_id)] 
     69        c.method = entity.t[id] 
     70        c.method_id = id 
     71        return render_response('/entity_t_methods/show.html') 
    5272     
    5373    def edit(self, id, format='html'):