~philip-peitsch/campopener/couchdb-backend

« back to all changes in this revision

Viewing changes to src/campopener/templates/camp/ListCamps.py

  • Committer: Philip Peitsch
  • Date: 2010-11-07 09:08:44 UTC
  • Revision ID: philip.peitsch@gmail.com-20101107090844-4vqn7eu9tpcx7skx
Removed autogen'ed template files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
 
3
 
 
4
 
 
5
 
 
6
 
##################################################
7
 
## DEPENDENCIES
8
 
import sys
9
 
import os
10
 
import os.path
11
 
try:
12
 
    import builtins as builtin
13
 
except ImportError:
14
 
    import __builtin__ as builtin
15
 
from os.path import getmtime, exists
16
 
import time
17
 
import types
18
 
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
19
 
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
20
 
from Cheetah.Template import Template
21
 
from Cheetah.DummyTransaction import *
22
 
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
23
 
from Cheetah.CacheRegion import CacheRegion
24
 
import Cheetah.Filters as Filters
25
 
import Cheetah.ErrorCatchers as ErrorCatchers
26
 
from campopener.templates.Site import Site
27
 
 
28
 
##################################################
29
 
## MODULE CONSTANTS
30
 
VFFSL=valueFromFrameOrSearchList
31
 
VFSL=valueFromSearchList
32
 
VFN=valueForName
33
 
currentTime=time.time
34
 
__CHEETAH_version__ = '2.4.3'
35
 
__CHEETAH_versionTuple__ = (2, 4, 3, 'development', 0)
36
 
__CHEETAH_genTime__ = 1289113167.6919999
37
 
__CHEETAH_genTimestamp__ = 'Sun Nov 07 17:59:27 2010'
38
 
__CHEETAH_src__ = 'campopener\\templates\\camp\\ListCamps.tmpl'
39
 
__CHEETAH_srcLastModified__ = 'Sun Nov 07 17:37:41 2010'
40
 
__CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
41
 
 
42
 
if __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
 
 
51
 
class ListCamps(Site):
52
 
 
53
 
    ##################################################
54
 
    ## CHEETAH GENERATED METHODS
55
 
 
56
 
 
57
 
    def __init__(self, *args, **KWs):
58
 
 
59
 
        super(ListCamps, self).__init__(*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 body(self, **KWS):
69
 
 
70
 
 
71
 
 
72
 
        ## CHEETAH: generated from #def body at line 4, col 1.
73
 
        trans = KWS.get("trans")
74
 
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
75
 
            trans = self.transaction # is None unless self.awake() was called
76
 
        if not trans:
77
 
            trans = DummyTransaction()
78
 
            _dummyTrans = True
79
 
        else: _dummyTrans = False
80
 
        write = trans.response().write
81
 
        SL = self._CHEETAH__searchList
82
 
        _filter = self._CHEETAH__currentFilter
83
 
        
84
 
        ########################################
85
 
        ## START - generated method body
86
 
        
87
 
        write(u'''<div id="content">
88
 
<h1>List all Camps</h1>
89
 
</div>
90
 
<table>
91
 
''')
92
 
        for camp in VFSL([locals()]+SL+[globals(), builtin],"camps",True): # generated from line 9, col 1
93
 
            write(u'''    <tr>
94
 
        <td>
95
 
            <div id="camp" class="mini">
96
 
                <div id="name">
97
 
                    ''')
98
 
            _v = VFSL([locals()]+SL+[globals(), builtin],"camp.Year",True) # u'$camp.Year' on line 14, col 21
99
 
            if _v is not None: write(_filter(_v, rawExpr=u'$camp.Year')) # from line 14, col 21.
100
 
            write(u''' - ''')
101
 
            _v = VFSL([locals()]+SL+[globals(), builtin],"camp.Name",True) # u'$camp.Name' on line 14, col 34
102
 
            if _v is not None: write(_filter(_v, rawExpr=u'$camp.Name')) # from line 14, col 34.
103
 
            write(u'''
104
 
                </div>
105
 
                <a href="''')
106
 
            _v = VFSL([locals()]+SL+[globals(), builtin],"url",False)(controller='camps',action='list', camp=VFSL([locals()]+SL+[globals(), builtin],"camp.Id",True)) # u"$url(controller='camps',action='list', camp=$camp.Id)" on line 16, col 26
107
 
            if _v is not None: write(_filter(_v, rawExpr=u"$url(controller='camps',action='list', camp=$camp.Id)")) # from line 16, col 26.
108
 
            write(u'''">link</a>
109
 
            </div>
110
 
        </td>
111
 
    </tr>
112
 
''')
113
 
        write(u'''</table>
114
 
''')
115
 
        
116
 
        ########################################
117
 
        ## END - generated method body
118
 
        
119
 
        return _dummyTrans and trans.response().getvalue() or ""
120
 
        
121
 
 
122
 
    def writeBody(self, **KWS):
123
 
 
124
 
 
125
 
 
126
 
        ## CHEETAH: main method generated for this template
127
 
        trans = KWS.get("trans")
128
 
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
129
 
            trans = self.transaction # is None unless self.awake() was called
130
 
        if not trans:
131
 
            trans = DummyTransaction()
132
 
            _dummyTrans = True
133
 
        else: _dummyTrans = False
134
 
        write = trans.response().write
135
 
        SL = self._CHEETAH__searchList
136
 
        _filter = self._CHEETAH__currentFilter
137
 
        
138
 
        ########################################
139
 
        ## START - generated method body
140
 
        
141
 
        write(u'''
142
 
''')
143
 
        
144
 
        ########################################
145
 
        ## END - generated method body
146
 
        
147
 
        return _dummyTrans and trans.response().getvalue() or ""
148
 
        
149
 
    ##################################################
150
 
    ## CHEETAH GENERATED ATTRIBUTES
151
 
 
152
 
 
153
 
    _CHEETAH__instanceInitialized = False
154
 
 
155
 
    _CHEETAH_version = __CHEETAH_version__
156
 
 
157
 
    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
158
 
 
159
 
    _CHEETAH_genTime = __CHEETAH_genTime__
160
 
 
161
 
    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
162
 
 
163
 
    _CHEETAH_src = __CHEETAH_src__
164
 
 
165
 
    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
166
 
 
167
 
    _mainCheetahMethod_for_ListCamps= 'writeBody'
168
 
 
169
 
## END CLASS DEFINITION
170
 
 
171
 
if not hasattr(ListCamps, '_initCheetahAttributes'):
172
 
    templateAPIClass = getattr(ListCamps, '_CHEETAH_templateClass', Template)
173
 
    templateAPIClass._addCheetahPlumbingCodeToClass(ListCamps)
174
 
 
175
 
 
176
 
# CHEETAH was developed by Tavis Rudd and Mike Orr
177
 
# with code, advice and input from many other volunteers.
178
 
# For more information visit http://www.CheetahTemplate.org/
179
 
 
180
 
##################################################
181
 
## if run from command line:
182
 
if __name__ == '__main__':
183
 
    from Cheetah.TemplateCmdLineIface import CmdLineIface
184
 
    CmdLineIface(templateObj=ListCamps()).run()
185
 
 
186