Changeset 2929

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

use mako templates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/mscott/SchevoPylonsNav/trunk/development.ini

    r2905 r2929  
    1212 
    1313[pipeline:main] 
    14 pipeline = dbopener toscawidgets logger schevopylonsnav 
     14pipeline = dbopener logger schevopylonsnav 
    1515 
    1616[filter:dbopener] 
     
    1818schevo.db.db = %(here)s/dev.db 
    1919verbose = true 
    20  
    21 [filter:toscawidgets] 
    22 use = egg:ToscaWidgets#middleware 
    23 host_framework = pylons 
    24 prefix = /_tw 
    2520 
    2621[filter:logger] 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/config/middleware.py

    r2905 r2929  
    3030    # Load our Pylons configuration defaults 
    3131    config = load_environment(global_conf, app_conf) 
    32     config.init_app(global_conf, app_conf, package='schevopylonsnav') 
     32    config.init_app(global_conf, app_conf, package='schevopylonsnav', 
     33                    template_engine='mako') 
    3334 
    34     # Set up Genshi-only template engine 
    35     config.template_engines = [] 
    36     genshi_options = dict( 
    37         (k, v) for k, v in app_conf.iteritems() if k.startswith('genshi') 
    38         ) 
    39     config.add_template_engine('genshi', 'schevopylonsnav.templates', genshi_options) 
    40          
    4135    # Load our default Pylons WSGI app and make g available 
    4236    app = pylons.wsgiapp.PylonsApp(config, helpers=schevopylonsnav.lib.helpers, 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/databases.py

    r2920 r2929  
    1313        """GET /: All items in the collection.""" 
    1414        # url_for('databases') 
    15         dbs = self.dbs 
    16         c.dbs_url = h.url_for('databases') 
    17         c.databases = databases = [] 
    18         for db_name, db in dbs.iteritems(): 
    19             db_label = label(db) 
    20             db_url = h.url_for('database', id=db_name) 
    21             databases.append((db_label, db_url)) 
    22         return render_response('databases.index') 
     15        c.dbs = self.dbs 
     16        return render_response('/databases/index.html') 
    2317     
    2418    def create(self): 
     
    5347        """GET /id: Show a specific item.""" 
    5448        # url_for('database', id=ID) 
    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') 
     49        c.db = self.dbs[id] 
     50        c.db_id = id 
     51        return render_response('/databases/show.html') 
    6152     
    6253    def edit(self, id, format='html'): 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/controllers/extents.py

    r2927 r2929  
    1313        """GET /: All items in the collection.""" 
    1414        # url_for('extents') 
    15         db = self.dbs[db_id] 
    16         c.databases_url = h.url_for('databases') 
    17         c.db_label = label(db) 
    18         c.db_url = h.url_for('database', id=db_id) 
    19         c.extents_url = h.url_for('extents', db_id=db_id) 
    20         c.extents = extents = [] 
    21         for extent in db.extents(): 
    22             extent_plural = plural(extent) 
    23             extent_url = h.url_for('extent', db_id=db_id, id=extent.name) 
    24             extents.append((extent_plural, extent_url)) 
    25         return render_response('extents.index') 
     15        c.db = self.dbs[db_id] 
     16        c.db_id = db_id 
     17        return render_response('/extents/index.html') 
    2618     
    2719    def create(self): 
     
    5648        """GET /id: Show a specific item.""" 
    5749        # url_for('extent', id=ID) 
    58         db = self.dbs[db_id] 
    59         c.databases_url = h.url_for('databases') 
    60         c.db_label = label(db) 
    61         c.db_url = h.url_for('database', id=db_id) 
    62         c.extents_url = h.url_for('extents', db_id=db_id) 
    63         extent = db.extent(id) 
    64         c.extent_label = label(extent) 
    65         c.extent_plural = plural(extent) 
    66         c.extent_len = len(extent) 
    67         c.extent_name = extent.name 
    68         c.extent_url = h.url_for('extent', db_id=db_id, id=id) 
    69         c.queries_url = h.url_for('extent_queries', db_id=db_id, extent_id=id) 
    70         c.transactions_url = h.url_for( 
    71             'extent_transactions', db_id=db_id, extent_id=id) 
    72         return render_response('extents.show') 
     50        c.db = db = self.dbs[db_id] 
     51        c.db_id = db_id 
     52        c.extent = db.extent(id) 
     53        return render_response('/extents/show.html') 
    7354     
    7455    def edit(self, id, format='html'): 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/lib/app_globals.py

    r2905 r2929  
    1 from toscawidgets.api import WidgetBunch 
    2  
    3  
    41class Globals(object): 
    52 
     
    2926             
    3027        """ 
    31         self.w = WidgetBunch() 
     28        pass 
    3229         
    3330    def __del__(self): 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/lib/base.py

    r2915 r2929  
    55from pylons.helpers import abort, redirect_to, etag_cache 
    66from pylons.i18n import N_, _, ungettext 
    7  
    8 from toscawidgets.api import retrieve_resources, WidgetBunch 
    97 
    108import schevopylonsnav.models as model 
     
    1715        # the action or route vars here 
    1816        # 
    19         # Create c.w namespace. 
    20         c.w = WidgetBunch() 
    2117        # Get Schevo database. 
    2218        self.dbs = environ['schevo.db'] 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/lib/helpers.py

    r2905 r2929  
    88from pylons.i18n import get_lang, set_lang 
    99 
    10 from toscawidgets.widgets.forms import HiddenField 
     10from schevo.label import label, plural 
    1111 
    1212 
    13 # Widgets for placement inside REST-style PUT and DELETE forms. 
    14 DELETE = HiddenField('_method', default='DELETE') 
    15 PUT = HiddenField('_method', default='PUT') 
     13# from toscawidgets.widgets.forms import HiddenField 
     14#  
     15#  
     16# # Widgets for placement inside REST-style PUT and DELETE forms. 
     17# DELETE = HiddenField('_method', default='DELETE') 
     18# PUT = HiddenField('_method', default='PUT') 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/databases/index.html

    r2928 r2929  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml"  
    3       xmlns:py="http://genshi.edgewall.org/" 
    4       xmlns:xi="http://www.w3.org/2001/XInclude"> 
    5 <xi:include href="../master.html"></xi:include> 
     2<html> 
    63    <head> 
    74        <title>Databases</title> 
     
    96    <body> 
    107        <div id="breadcrumbs"> 
    11             <a href="${c.dbs_url}">Databases</a> 
     8            <a href="${h.url_for('databases')}">Databases</a> 
    129        </div> 
    1310                 
    1411                <ul> 
    15                         <li py:for="db_label, db_url in c.databases"> 
    16                                 <a href="${db_url}">${db_label}</a> 
    17                         </li> 
     12                    % for db_id, db in c.dbs.iteritems(): 
     13                        <li> 
     14                            <a href="${h.url_for('database', id=db_id)}">${h.label(db)}</a> 
     15                        </li> 
     16                    % endfor 
    1817                </ul> 
    1918    </body> 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/databases/show.html

    r2928 r2929  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml"  
    3       xmlns:py="http://genshi.edgewall.org/" 
    4       xmlns:xi="http://www.w3.org/2001/XInclude"> 
    5 <xi:include href="../master.html"></xi:include> 
     2<html> 
    63    <head> 
    7         <title>${c.db_label} &larr; Databases</title> 
     4        <title>${h.label(c.db)} &larr; Databases</title> 
    85    </head> 
    96    <body> 
    107        <div id="breadcrumbs"> 
    11             <a href="${c.dbs_url}">Databases</a> 
     8            <a href="${h.url_for('databases')}">Databases</a> 
    129            &rarr; 
    13             <a href="${c.db_url}">${c.db_label}</a> 
     10            <a href="${h.url_for('database', id=c.db_id)}">${h.label(c.db)}</a> 
    1411        </div> 
    1512 
    1613                <ul> 
    1714                        <li> 
    18                                 <a href="${c.extents_url}">Extents</a> 
     15                                <a href="${h.url_for('extents', db_id=c.db_id)}">Extents</a> 
    1916                        </li> 
    2017                </ul> 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extents/index.html

    r2928 r2929  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml"  
    3       xmlns:py="http://genshi.edgewall.org/" 
    4       xmlns:xi="http://www.w3.org/2001/XInclude"> 
    5 <xi:include href="../master.html"></xi:include> 
     2<html> 
    63    <head> 
    7         <title>Extents &larr; ${c.db_label} &larr; Databases</title> 
     4        <title>Extents &larr; ${h.label(c.db)} &larr; Databases</title> 
    85    </head> 
    96    <body> 
    107        <div id="breadcrumbs"> 
    11             <a href="${c.databases_url}">Databases</a> 
     8            <a href="${h.url_for('databases')}">Databases</a> 
    129            &rarr; 
    13             <a href="${c.db_url}">${c.db_label}</a> 
     10            <a href="${h.url_for('database', id=c.db_id)}">${h.label(c.db)}</a> 
    1411            &rarr; 
    15             <a href="${c.extents_url}">Extents</a> 
     12            <a href="${h.url_for('extents', db_id=c.db_id)}">Extents</a> 
    1613        </div> 
    1714         
    1815                <ul> 
    19                         <li py:for="extent_plural, extent_url in c.extents"> 
    20                                 <a href="${extent_url}">${extent_plural}</a> 
    21                         </li> 
     16                    % for extent in c.db.extents(): 
     17                        <li> 
     18                            <a href="${h.url_for('extent', db_id=c.db_id, id=extent.name)}" 
     19                                >${h.plural(extent)}</a> 
     20                        </li> 
     21                    % endfor 
    2222                </ul> 
    2323    </body> 
  • sandbox/mscott/SchevoPylonsNav/trunk/schevopylonsnav/templates/extents/show.html

    r2928 r2929  
    11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml"  
    3       xmlns:py="http://genshi.edgewall.org/" 
    4       xmlns:xi="http://www.w3.org/2001/XInclude"> 
    5 <xi:include href="../master.html"></xi:include> 
     2<html> 
    63    <head> 
    7         <title>${c.extent_plural} in ${c.db_label} -- Navigator</title> 
     4        <title> 
     5            ${h.plural(c.extent)} 
     6            &larr; 
     7            Extents 
     8            &larr; 
     9            ${h.label(c.db)} 
     10            &larr; 
     11            Databases 
     12        </title> 
    813    </head> 
    914    <body> 
    1015        <div id="breadcrumbs"> 
    11             <a href="${c.databases_url}">Databases</a> 
     16            <a href="${h.url_for('databases')}">Databases</a> 
    1217            &rarr; 
    13             <a href="${c.db_url}">${c.db_label}</a> 
     18            <a href="${h.url_for('database', id=c.db_id)}">${h.label(c.db)}</a> 
    1419            &rarr; 
    15             <a href="${c.extents_url}">Extents</a> 
     20            <a href="${h.url_for('extents', db_id=c.db_id)}">Extents</a> 
    1621            &rarr; 
    17             <a href="${c.extent_url}">${c.extent_plural}</a> 
     22            <a href="${h.url_for('extent', db_id=c.db_id, id=c.extent.name)}" 
     23                >${h.plural(c.extent)}</a> 
    1824        </div> 
    1925         
    2026                <dl> 
    2127                        <dt>Name</dt> 
    22                         <dd>${c.extent_name}</dd> 
     28                        <dd>${c.extent.name}</dd> 
    2329                         
    2430                        <dt>Label</dt> 
    25                         <dd>${c.extent_label}</dd> 
     31                        <dd>${h.label(c.extent)}</dd> 
    2632                         
    2733                        <dt>Plural label</dt> 
    28                         <dd>${c.extent_plural}</dd> 
     34                        <dd>${h.plural(c.extent)}</dd> 
    2935                         
    3036                        <dt>Length</dt> 
    31                         <dd>${c.extent_len}</dd> 
     37                        <dd>${len(c.extent)}</dd> 
    3238                </dl> 
    3339 
    3440                <ul> 
    3541                        <li> 
    36                                 <a href="${c.queries_url}">Queries</a> 
     42                                <a href="${h.url_for('extent_queries', db_id=c.db_id, extent_id=c.extent.name)}" 
     43                                    >Queries</a> 
    3744                        </li> 
    3845                         
    3946                        <li> 
    40                             <a href="${c.transactions_url}">Transactions</a> 
     47                            <a href="${h.url_for('extent_transactions', db_id=c.db_id, extent_id=c.extent.name)}" 
     48                                >Transactions</a> 
    4149                        </li> 
    4250                </ul> 
  • sandbox/mscott/SchevoPylonsNav/trunk/setup.py

    r2911 r2929  
    2323 
    2424    install_requires = [ 
    25     'Genshi==dev,>=0.4dev-r493', 
     25    # 'Genshi==dev,>=0.4dev-r493', 
    2626    'Pylons==dev,>=0.9.5dev-r1770', 
    2727    'Schevo==dev,>=3.0b4dev-r2831', 
    2828    'SchevoWsgi==dev,>=0.1a1dev-r2820', 
    29     'ToscaWidgets==dev,>=0.1a2dev-r2454', 
    30     'twForms==dev,>=0.1a2dev-r2418', 
     29    # 'ToscaWidgets==dev,>=0.1a2dev-r2454', 
     30    # 'twForms==dev,>=0.1a2dev-r2418', 
     31    'Mako', 
    3132    ], 
    3233     
  • sandbox/mscott/SchevoPylonsNav/trunk/test.ini

    r2913 r2929  
    1616 
    1717[pipeline:main] 
    18 pipeline = dbopener toscawidgets schevopylonsnav 
     18pipeline = dbopener schevopylonsnav 
    1919 
    2020[filter:dbopener] 
     
    2222schevo.db.db = memory://schevopylonsnav.schema/1 
    2323verbose = true 
    24  
    25 [filter:toscawidgets] 
    26 use = egg:ToscaWidgets#middleware 
    27 host_framework = pylons 
    28 prefix = /_tw 
    2924 
    3025[app:schevopylonsnav]