~ubuntu-branches/ubuntu/gutsy/prewikka/gutsy

« back to all changes in this revision

Viewing changes to prewikka/templates/LoginPasswordForm.py

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2007-04-11 14:41:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070411144109-2hh7zx3amwd27b4l
Tags: upstream-0.9.10
ImportĀ upstreamĀ versionĀ 0.9.10

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
from os.path import getmtime, exists
 
12
import time
 
13
import types
 
14
import __builtin__
 
15
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
 
16
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
 
17
from Cheetah.Template import Template
 
18
from Cheetah.DummyTransaction import DummyTransaction
 
19
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
 
20
from Cheetah.CacheRegion import CacheRegion
 
21
import Cheetah.Filters as Filters
 
22
import Cheetah.ErrorCatchers as ErrorCatchers
 
23
from prewikka.templates.TopLayout import TopLayout
 
24
 
 
25
##################################################
 
26
## MODULE CONSTANTS
 
27
try:
 
28
    True, False
 
29
except NameError:
 
30
    True, False = (1==1), (1==0)
 
31
VFFSL=valueFromFrameOrSearchList
 
32
VFSL=valueFromSearchList
 
33
VFN=valueForName
 
34
currentTime=time.time
 
35
__CHEETAH_version__ = '2.0rc7'
 
36
__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 7)
 
37
__CHEETAH_genTime__ = 1175011472.954596
 
38
__CHEETAH_genTimestamp__ = 'Tue Mar 27 18:04:32 2007'
 
39
__CHEETAH_src__ = 'prewikka/templates/LoginPasswordForm.tmpl'
 
40
__CHEETAH_srcLastModified__ = 'Tue Mar 27 18:04:24 2007'
 
41
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
 
42
 
 
43
if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
 
44
    raise AssertionError(
 
45
      'This template was compiled with Cheetah version'
 
46
      ' %s. Templates compiled before version %s must be recompiled.'%(
 
47
         __CHEETAH_version__, RequiredCheetahVersion))
 
48
 
 
49
##################################################
 
50
## CLASSES
 
51
 
 
52
class LoginPasswordForm(TopLayout):
 
53
 
 
54
    ##################################################
 
55
    ## CHEETAH GENERATED METHODS
 
56
 
 
57
 
 
58
    def __init__(self, *args, **KWs):
 
59
 
 
60
        TopLayout.__init__(self, *args, **KWs)
 
61
        if not self._CHEETAH__instanceInitialized:
 
62
            cheetahKWArgs = {}
 
63
            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
 
64
            for k,v in KWs.items():
 
65
                if k in allowedKWs: cheetahKWArgs[k] = v
 
66
            self._initCheetahInstance(**cheetahKWArgs)
 
67
        
 
68
 
 
69
    def toplayout_content(self, **KWS):
 
70
 
 
71
 
 
72
 
 
73
        ## CHEETAH: generated from #block toplayout_content at line 3, col 1.
 
74
        trans = KWS.get("trans")
 
75
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
76
            trans = self.transaction # is None unless self.awake() was called
 
77
        if not trans:
 
78
            trans = DummyTransaction()
 
79
            _dummyTrans = True
 
80
        else: _dummyTrans = False
 
81
        write = trans.response().write
 
82
        SL = self._CHEETAH__searchList
 
83
        _filter = self._CHEETAH__currentFilter
 
84
        
 
85
        ########################################
 
86
        ## START - generated method body
 
87
        
 
88
        _orig_filter_24756153 = _filter
 
89
        filterName = 'CleanOutput'
 
90
        if self._CHEETAH__filters.has_key("CleanOutput"):
 
91
            _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName]
 
92
        else:
 
93
            _filter = self._CHEETAH__currentFilter = \
 
94
                        self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter
 
95
        write('''
 
96
<div id="fieldset_page" style="position: absolute; top: 25%; left: 50%; width: 330px; margin-left: -165px;">
 
97
<fieldset>
 
98
  <legend>User authentication</legend>
 
99
  <table>
 
100
    <form action="?" method="post">
 
101
''')
 
102
        for name, value in VFFSL(SL,"arguments",True): # generated from line 11, col 7
 
103
            if type(VFFSL(SL,"value",True)) is list: # generated from line 12, col 9
 
104
                for val in VFFSL(SL,"value",True): # generated from line 13, col 11
 
105
                    write('            <input type="hidden" name="')
 
106
                    _v = VFFSL(SL,"name",True) # '$name' on line 14, col 40
 
107
                    if _v is not None: write(_filter(_v, rawExpr='$name')) # from line 14, col 40.
 
108
                    write('" value="')
 
109
                    _v = VFFSL(SL,"val",True) # '$val' on line 14, col 54
 
110
                    if _v is not None: write(_filter(_v, rawExpr='$val')) # from line 14, col 54.
 
111
                    write('"/>\n')
 
112
            else: # generated from line 16, col 9
 
113
                write('          <input type="hidden" name="')
 
114
                _v = VFFSL(SL,"name",True) # '$name' on line 17, col 38
 
115
                if _v is not None: write(_filter(_v, rawExpr='$name')) # from line 17, col 38.
 
116
                write('" value="')
 
117
                _v = VFFSL(SL,"value",True) # '$value' on line 17, col 52
 
118
                if _v is not None: write(_filter(_v, rawExpr='$value')) # from line 17, col 52.
 
119
                write('"/>\n')
 
120
        write('''      <tr>
 
121
        <th>Login:</th>
 
122
        <td><input type="text" name="_login"/></td>
 
123
      </tr>
 
124
      <tr>
 
125
        <th>Password:</th>
 
126
        <td><input type="password" name="_password"/></td>
 
127
      </tr>
 
128
     </table>
 
129
 
 
130
     <input style="float: right;" type="submit" value="''')
 
131
        if False:
 
132
            _("Submit")
 
133
        _v = VFFSL(SL,"_",False)("Submit") # '$_("Submit")' on line 30, col 56
 
134
        if _v is not None: write(_filter(_v, rawExpr='$_("Submit")')) # from line 30, col 56.
 
135
        write('"/>\n     <span class="authentication_error">')
 
136
        _v = VFFSL(SL,"message",True) # '$message' on line 31, col 41
 
137
        if _v is not None: write(_filter(_v, rawExpr='$message')) # from line 31, col 41.
 
138
        write('''</span>
 
139
    </form>
 
140
 </fieldset>
 
141
</div>
 
142
 
 
143
''')
 
144
        _filter = _orig_filter_24756153
 
145
        
 
146
        ########################################
 
147
        ## END - generated method body
 
148
        
 
149
        return _dummyTrans and trans.response().getvalue() or ""
 
150
        
 
151
 
 
152
    def writeBody(self, **KWS):
 
153
 
 
154
 
 
155
 
 
156
        ## CHEETAH: main method generated for this template
 
157
        trans = KWS.get("trans")
 
158
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
159
            trans = self.transaction # is None unless self.awake() was called
 
160
        if not trans:
 
161
            trans = DummyTransaction()
 
162
            _dummyTrans = True
 
163
        else: _dummyTrans = False
 
164
        write = trans.response().write
 
165
        SL = self._CHEETAH__searchList
 
166
        _filter = self._CHEETAH__currentFilter
 
167
        
 
168
        ########################################
 
169
        ## START - generated method body
 
170
        
 
171
        write('\n')
 
172
        self.toplayout_content(trans=trans)
 
173
        
 
174
        ########################################
 
175
        ## END - generated method body
 
176
        
 
177
        return _dummyTrans and trans.response().getvalue() or ""
 
178
        
 
179
    ##################################################
 
180
    ## CHEETAH GENERATED ATTRIBUTES
 
181
 
 
182
 
 
183
    _CHEETAH__instanceInitialized = False
 
184
 
 
185
    _CHEETAH_version = __CHEETAH_version__
 
186
 
 
187
    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
 
188
 
 
189
    _CHEETAH_genTime = __CHEETAH_genTime__
 
190
 
 
191
    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
 
192
 
 
193
    _CHEETAH_src = __CHEETAH_src__
 
194
 
 
195
    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
 
196
 
 
197
    _mainCheetahMethod_for_LoginPasswordForm= 'writeBody'
 
198
 
 
199
## END CLASS DEFINITION
 
200
 
 
201
if not hasattr(LoginPasswordForm, '_initCheetahAttributes'):
 
202
    templateAPIClass = getattr(LoginPasswordForm, '_CHEETAH_templateClass', Template)
 
203
    templateAPIClass._addCheetahPlumbingCodeToClass(LoginPasswordForm)
 
204
 
 
205
 
 
206
# CHEETAH was developed by Tavis Rudd and Mike Orr
 
207
# with code, advice and input from many other volunteers.
 
208
# For more information visit http://www.CheetahTemplate.org/
 
209
 
 
210
##################################################
 
211
## if run from command line:
 
212
if __name__ == '__main__':
 
213
    from Cheetah.TemplateCmdLineIface import CmdLineIface
 
214
    CmdLineIface(templateObj=LoginPasswordForm()).run()
 
215
 
 
216