Changeset 2098


Ignore:
Timestamp:
06/30/10 20:40:06 (20 months ago)
Author:
dart
Message:

LoReality?:
o Update

Location:
trunk/loreality
Files:
8 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/loreality/data/templates/base/index.html.py

    r2097 r2098  
    44__M_locals_builtin = locals 
    55_magic_number = 5 
    6 _modified_time = 1277908898.521735 
    7 _template_filename='/media/divers/personnel/dev/dartsite.org/lotatc/trunk/loreality/loreality/templates/base/index.html' 
     6_modified_time = 1277927792.169724 
     7_template_filename='/home/dart/trunk/loreality/loreality/templates/base/index.html' 
    88_template_uri='/base/index.html' 
    99_template_cache=cache.Cache(__name__, _modified_time) 
    1010_source_encoding='utf-8' 
    1111from webhelpers.html import escape 
    12 _exports = ['head', 'title', 'tabs', 'menu', 'footer', 'header', 'breadcrumbs', 'heading'] 
     12_exports = ['head', 'title', 'tabs', 'menu', 'footer', 'header', 'heading'] 
    1313 
     14 
     15def _mako_get_namespace(context, name): 
     16    try: 
     17        return context.namespaces[(__name__, name)] 
     18    except KeyError: 
     19        _mako_generate_namespaces(context) 
     20        return context.namespaces[(__name__, name)] 
     21def _mako_generate_namespaces(context): 
     22    # SOURCE LINE 2 
     23    ns = runtime.Namespace('navigation', context._clean_inheritance_tokens(), templateuri='/component/navigation.html', callables=None, calling_uri=_template_uri, module=None) 
     24    context.namespaces[(__name__, 'navigation')] = ns 
    1425 
    1526def render_body(context,**pageargs): 
     
    1728    try: 
    1829        __M_locals = __M_dict_builtin(pageargs=pageargs) 
    19         h = context.get('h', UNDEFINED) 
    20         self = context.get('self', UNDEFINED) 
    21         request = context.get('request', UNDEFINED) 
    22         next = context.get('next', UNDEFINED) 
     30        _import_ns = {} 
     31        _mako_get_namespace(context, 'navigation')._populate(_import_ns, ['*']) 
     32        h = _import_ns.get('h', context.get('h', UNDEFINED)) 
     33        self = _import_ns.get('self', context.get('self', UNDEFINED)) 
     34        request = _import_ns.get('request', context.get('request', UNDEFINED)) 
     35        next = _import_ns.get('next', context.get('next', UNDEFINED)) 
    2336        __M_writer = context.writer() 
    24         # SOURCE LINE 2 
     37        __M_writer(u'') 
     38        # SOURCE LINE 3 
    2539        __M_writer(u'\n<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n"http://www.w3.org/TR/html4/strict.dtd">\n<html>\n<head>\n    <title>') 
    26         # SOURCE LINE 7 
     40        # SOURCE LINE 8 
    2741        __M_writer(escape(self.title())) 
    2842        __M_writer(u'</title>\n    ') 
    29         # SOURCE LINE 8 
     43        # SOURCE LINE 9 
    3044        __M_writer(escape(self.head())) 
    3145        __M_writer(u'\n</head>\n<body>\n    <div id="hd">\n        <div class="yui-gc">\n            <div class="yui-u first">\n                ') 
    32         # SOURCE LINE 14 
     46        # SOURCE LINE 15 
    3347        __M_writer(escape(self.heading())) 
    3448        __M_writer(u'\n            </div>\n            <div class="yui-u">\n') 
    35         # SOURCE LINE 17 
     49        # SOURCE LINE 18 
    3650        if h.auth.authorized(h.auth.is_valid_user) and not (request.urlvars['controller'] == 'account' and request.urlvars['action'] == 'signout'): 
    37             # SOURCE LINE 18 
     51            # SOURCE LINE 19 
    3852            __M_writer(u'                    <p>Signed in as ') 
    3953            __M_writer(escape(request.environ['REMOTE_USER'])) 
    4054            __M_writer(u',\n                        <a href="') 
    41             # SOURCE LINE 19 
     55            # SOURCE LINE 20 
    4256            __M_writer(escape(h.url_for('signout'))) 
    4357            __M_writer(u'">Sign out</a></p>\n') 
    44             # SOURCE LINE 20 
     58            # SOURCE LINE 21 
    4559        else: 
    46             # SOURCE LINE 21 
     60            # SOURCE LINE 22 
    4761            __M_writer(u'                    <p><a href="') 
    4862            __M_writer(escape(h.url_for('signin'))) 
    4963            __M_writer(u'">Sign in</a></p>\n') 
    50         # SOURCE LINE 23 
     64        # SOURCE LINE 24 
    5165        __M_writer(u'            </div>\n        </div>\n        ') 
    52         # SOURCE LINE 25 
     66        # SOURCE LINE 26 
    5367        __M_writer(escape(self.header())) 
    5468        __M_writer(u'\n        ') 
    55         # SOURCE LINE 26 
     69        # SOURCE LINE 27 
    5670        __M_writer(escape(self.tabs())) 
    5771        __M_writer(u'\n    </div>\n    ') 
    58         # SOURCE LINE 28 
     72        # SOURCE LINE 29 
    5973        __M_writer(escape(self.menu())) 
    6074        __M_writer(u'\n    ') 
    61         # SOURCE LINE 29 
     75        # SOURCE LINE 30 
    6276        __M_writer(escape(self.heading())) 
    63         __M_writer(u'\n    ') 
    64         # SOURCE LINE 30 
    65         __M_writer(escape(self.breadcrumbs())) 
    6677        __M_writer(u'\n    ') 
    6778        # SOURCE LINE 31 
     
    8596        # SOURCE LINE 42 
    8697        __M_writer(u'\n') 
    87         # SOURCE LINE 43 
    88         __M_writer(u'\n') 
    8998        return '' 
    9099    finally: 
     
    95104    context.caller_stack._push_frame() 
    96105    try: 
     106        _import_ns = {} 
     107        _mako_get_namespace(context, 'navigation')._populate(_import_ns, ['*']) 
    97108        __M_writer = context.writer() 
    98109        return '' 
     
    104115    context.caller_stack._push_frame() 
    105116    try: 
     117        _import_ns = {} 
     118        _mako_get_namespace(context, 'navigation')._populate(_import_ns, ['*']) 
    106119        __M_writer = context.writer() 
    107120        # SOURCE LINE 36 
     
    115128    context.caller_stack._push_frame() 
    116129    try: 
     130        _import_ns = {} 
     131        _mako_get_namespace(context, 'navigation')._populate(_import_ns, ['*']) 
     132        navigation = _mako_get_namespace(context, 'navigation') 
    117133        __M_writer = context.writer() 
     134        # SOURCE LINE 39 
     135        __M_writer(escape(navigation.tabs())) 
    118136        return '' 
    119137    finally: 
     
    124142    context.caller_stack._push_frame() 
    125143    try: 
     144        _import_ns = {} 
     145        _mako_get_namespace(context, 'navigation')._populate(_import_ns, ['*']) 
     146        navigation = _mako_get_namespace(context, 'navigation') 
    126147        __M_writer = context.writer() 
     148        # SOURCE LINE 40 
     149        __M_writer(escape(navigation.menu())) 
    127150        return '' 
    128151    finally: 
     
    133156    context.caller_stack._push_frame() 
    134157    try: 
     158        _import_ns = {} 
     159        _mako_get_namespace(context, 'navigation')._populate(_import_ns, ['*']) 
    135160        __M_writer = context.writer() 
    136         # SOURCE LINE 43 
     161        # SOURCE LINE 42 
    137162        __M_writer(u'<p><a href="#top">Top ^</a></p>') 
    138163        return '' 
     
    144169    context.caller_stack._push_frame() 
    145170    try: 
     171        _import_ns = {} 
     172        _mako_get_namespace(context, 'navigation')._populate(_import_ns, ['*']) 
    146173        __M_writer = context.writer() 
    147174        # SOURCE LINE 38 
     
    152179 
    153180 
    154 def render_breadcrumbs(context): 
    155     context.caller_stack._push_frame() 
    156     try: 
    157         __M_writer = context.writer() 
    158         return '' 
    159     finally: 
    160         context.caller_stack._pop_frame() 
    161  
    162  
    163181def render_heading(context): 
    164182    context.caller_stack._push_frame() 
    165183    try: 
    166         c = context.get('c', UNDEFINED) 
     184        _import_ns = {} 
     185        _mako_get_namespace(context, 'navigation')._populate(_import_ns, ['*']) 
     186        c = _import_ns.get('c', context.get('c', UNDEFINED)) 
    167187        __M_writer = context.writer() 
    168188        # SOURCE LINE 41 
  • trunk/loreality/development.ini

    r2097 r2098  
    4343authkit.setup.enable = true 
    4444authkit.setup.method = form, cookie 
    45 authkit.form.authenticate.user.type = authkit.users.sqlalchemy_driver:UsersFromDatabase 
    46 authkit.form.authenticate.user.data = loreality.model 
    47 #authkit.form.authenticate.user.data = dart:admin 
     45#authkit.form.authenticate.user.type = authkit.users.sqlalchemy_driver:UsersFromDatabase 
     46#authkit.form.authenticate.user.data = loreality.model 
     47authkit.form.authenticate.user.data = dart:admin 
    4848authkit.cookie.secret = aoeuidts 
    4949authkit.cookie.signoutpath = /signout 
  • trunk/loreality/loreality/controllers/account.py

    r2097 r2098  
    55 
    66from loreality.lib.base import BaseController, render 
     7import loreality.lib.helpers as h 
    78 
    89log = logging.getLogger(__name__) 
     
    1516            abort(401) 
    1617        else: 
    17             return render('/derived/account/signedin.html') 
     18            return redirect_to(h.url_for(controller='main', action='index')) 
    1819 
    1920    def signout(self): 
  • trunk/loreality/loreality/model/__init__.py

    r2097 r2098  
    1818 
    1919# Non-reflected tables may be defined and mapped at module level 
    20 #users_table = sa.Table("Users", meta.metadata, 
    21 #    sa.Column("id", sa.types.Integer, primary_key=True), 
    22 #    sa.Column("login", sa.types.String(255), nullable=False), 
    23 #    ) 
    24 # 
    25 #class User(object): 
    26 #    pass 
    27 # 
    28 #orm.mapper(User, users_table) 
     20users_table = sa.Table("Pilots", meta.metadata, 
     21    sa.Column("id", sa.types.Integer, primary_key=True), 
     22    sa.Column("login", sa.types.String(255), nullable=False), 
     23    sa.Column("squadron", sa.types.String(255), nullable=False), 
     24    ) 
     25mission_table = sa.Table("Missions", meta.metadata, 
     26    sa.Column("id", sa.types.Integer, primary_key=True), 
     27    sa.Column("name", sa.types.String(255), nullable=False), 
     28    ) 
     29 
     30class User(object): 
     31    pass 
     32 
     33class Mission(object): 
     34    pass 
     35 
     36 
     37orm.mapper(User, users_table) 
     38orm.mapper(Mission, mission_table) 
    2939 
    3040 
  • trunk/loreality/loreality/templates/base/index.html

    r2097 r2098  
    11## -*- coding: utf-8 -*- 
     2<%namespace name="navigation" file="/component/navigation.html" import="*" />\ 
    23 
    34<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
     
    2829    ${self.menu()} 
    2930    ${self.heading()} 
    30     ${self.breadcrumbs()} 
    3131    ${next.body()} 
    3232    ${self.footer()} 
     
    3737<%def name="head()"></%def> 
    3838<%def name="header()"><a name="top"></a></%def> 
    39 <%def name="tabs()"></%def> 
    40 <%def name="menu()"></%def> 
     39<%def name="tabs()">${navigation.tabs()}</%def> 
     40<%def name="menu()">${navigation.menu()}</%def> 
    4141<%def name="heading()"><h1>${c.heading or 'No Title'}</h1></%def> 
    42 <%def name="breadcrumbs()"></%def> 
    4342<%def name="footer()"><p><a href="#top">Top ^</a></p></%def> 
  • trunk/loreality/loreality/templates/main.html

    r2097 r2098  
    22<%namespace file="/menu.html" import="get_menu" /> 
    33 
     4<%def name="menu()"> 
    45${get_menu('Home', links=[ 
    56    ('Home', '/'), 
    67    ('Sign Out', '/admin/signout'), 
    78])} 
     9</%def> 
    810 
    911 
  • trunk/loreality/loreality/websetup.py

    r2097 r2098  
    2727    users.user_add_role("DArt", role="admin" ) 
    2828    print users.user("dart") 
     29 
     30    log.info("Adding mission...") 
     31    mis = model.Mission() 
     32    mis.name=u'Mission 1' 
     33    meta.Session.add(mis) 
     34    meta.Session.commit() 
     35    log.info("Successfully set up.") 
     36 
Note: See TracChangeset for help on using the changeset viewer.