source: trunk/web/templates/mainpage.py @ 233

Last change on this file since 233 was 113, checked in by ecprice, 17 years ago

Initial import of web interface.

File size: 6.0 KB
Line 
1#!/usr/bin/env python
2
3
4
5
6##################################################
7## DEPENDENCIES
8import sys
9import os
10import os.path
11from os.path import getmtime, exists
12import time
13import types
14import __builtin__
15from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
16from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
17from Cheetah.Template import Template
18from Cheetah.DummyTransaction import DummyTransaction
19from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
20from Cheetah.CacheRegion import CacheRegion
21import Cheetah.Filters as Filters
22import Cheetah.ErrorCatchers as ErrorCatchers
23
24##################################################
25## MODULE CONSTANTS
26try:
27    True, False
28except NameError:
29    True, False = (1==1), (1==0)
30VFFSL=valueFromFrameOrSearchList
31VFSL=valueFromSearchList
32VFN=valueForName
33currentTime=time.time
34__CHEETAH_version__ = '2.0rc8'
35__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
36__CHEETAH_genTime__ = 1191715796.9141691
37__CHEETAH_genTimestamp__ = 'Sat Oct  6 20:09:56 2007'
38__CHEETAH_src__ = 'mainpage.tmpl'
39__CHEETAH_srcLastModified__ = 'Sat Oct  6 20:09:44 2007'
40__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
41
42if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
43    raise AssertionError(
44      'This template was compiled with Cheetah version'
45      ' %s. Templates compiled before version %s must be recompiled.'%(
46         __CHEETAH_version__, RequiredCheetahVersion))
47
48##################################################
49## CLASSES
50
51class mainpage(Template):
52
53    ##################################################
54    ## CHEETAH GENERATED METHODS
55
56
57    def __init__(self, *args, **KWs):
58
59        Template.__init__(self, *args, **KWs)
60        if not self._CHEETAH__instanceInitialized:
61            cheetahKWArgs = {}
62            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
63            for k,v in KWs.items():
64                if k in allowedKWs: cheetahKWArgs[k] = v
65            self._initCheetahInstance(**cheetahKWArgs)
66       
67
68    def respond(self, trans=None):
69
70
71
72        ## CHEETAH: main method generated for this template
73        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
74            trans = self.transaction # is None unless self.awake() was called
75        if not trans:
76            trans = DummyTransaction()
77            _dummyTrans = True
78        else: _dummyTrans = False
79        write = trans.response().write
80        SL = self._CHEETAH__searchList
81        _filter = self._CHEETAH__currentFilter
82       
83        ########################################
84        ## START - generated method body
85       
86        write('''<html>
87<head><title>Status for order #''')
88        _v = VFFSL(SL,"order.id",True) # '$order.id' on line 2, col 32
89        if _v is not None: write(_filter(_v, rawExpr='$order.id')) # from line 2, col 32.
90        write('''</title></head>
91<body>
92<p>[You are logged in as ''')
93        _v = VFN(VFFSL(SL,"user",True),"getFullName",False)() # '$user.getFullName()' on line 4, col 26
94        if _v is not None: write(_filter(_v, rawExpr='$user.getFullName()')) # from line 4, col 26.
95        write('''.]</p>
96<p>
97''')
98        if (VFN(VFFSL(SL,"order",True),"hasShipped",False)()): # generated from line 6, col 1
99            write(''' Your order has shipped. Your tracking number is ''')
100            _v = VFFSL(SL,"order.trackingNumber",True) # '$order.trackingNumber' on line 7, col 50
101            if _v is not None: write(_filter(_v, rawExpr='$order.trackingNumber')) # from line 7, col 50.
102            write('''.
103''')
104        else: # generated from line 8, col 1
105            write(''' Your order has not yet shipped.
106''')
107        write('''</p>
108<p>Order #''')
109        _v = VFFSL(SL,"order.id",True) # '$order.id' on line 12, col 11
110        if _v is not None: write(_filter(_v, rawExpr='$order.id')) # from line 12, col 11.
111        write(''' contains the following items:</p>
112<ul>
113''')
114        for purchased, quantity in VFN(VFFSL(SL,"order.purchased",True),"items",False)(): # generated from line 14, col 1
115            write(''' <li>''')
116            _v = VFFSL(SL,"purchased.name",True) # '$purchased.name' on line 15, col 6
117            if _v is not None: write(_filter(_v, rawExpr='$purchased.name')) # from line 15, col 6.
118            write(''': ''')
119            _v = VFFSL(SL,"quantity",True) # '$quantity' on line 15, col 23
120            if _v is not None: write(_filter(_v, rawExpr='$quantity')) # from line 15, col 23.
121            write(''' unit''')
122            if (VFFSL(SL,"quantity",True) != 1): # generated from line 16, col 1
123                write('''s
124''')
125            write('''</li>
126''')
127        write('''</ul>
128<hr />
129Served by Online Store v1.0
130</body>
131</html>
132''')
133       
134        ########################################
135        ## END - generated method body
136       
137        return _dummyTrans and trans.response().getvalue() or ""
138       
139    ##################################################
140    ## CHEETAH GENERATED ATTRIBUTES
141
142
143    _CHEETAH__instanceInitialized = False
144
145    _CHEETAH_version = __CHEETAH_version__
146
147    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
148
149    _CHEETAH_genTime = __CHEETAH_genTime__
150
151    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
152
153    _CHEETAH_src = __CHEETAH_src__
154
155    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
156
157    _mainCheetahMethod_for_mainpage= 'respond'
158
159## END CLASS DEFINITION
160
161if not hasattr(mainpage, '_initCheetahAttributes'):
162    templateAPIClass = getattr(mainpage, '_CHEETAH_templateClass', Template)
163    templateAPIClass._addCheetahPlumbingCodeToClass(mainpage)
164
165
166# CHEETAH was developed by Tavis Rudd and Mike Orr
167# with code, advice and input from many other volunteers.
168# For more information visit http://www.CheetahTemplate.org/
169
170##################################################
171## if run from command line:
172if __name__ == '__main__':
173    from Cheetah.TemplateCmdLineIface import CmdLineIface
174    CmdLineIface(templateObj=mainpage()).run()
175
176
Note: See TracBrowser for help on using the repository browser.