]> git.phdru.name Git - phdru.name/cgi-bin/blog-ru/search-tags.git/blob - html/redirect.py
TODO: use parsimonious or parsley instead of grako
[phdru.name/cgi-bin/blog-ru/search-tags.git] / html / redirect.py
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 Redirect import Redirect
27
28 ##################################################
29 ## MODULE CONSTANTS
30 VFFSL=valueFromFrameOrSearchList
31 VFSL=valueFromSearchList
32 VFN=valueForName
33 currentTime=time.time
34 __CHEETAH_version__ = '2.4.4'
35 __CHEETAH_versionTuple__ = (2, 4, 4, 'development', 1)
36 __CHEETAH_genTime__ = 1400552323.307355
37 __CHEETAH_genTimestamp__ = 'Tue May 20 06:18:43 2014'
38 __CHEETAH_src__ = 'redirect.tmpl'
39 __CHEETAH_srcLastModified__ = 'Thu Feb  3 17:59:20 2005'
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 redirect(Redirect):
52
53     ##################################################
54     ## CHEETAH GENERATED METHODS
55
56
57     def __init__(self, *args, **KWs):
58
59         super(redirect, 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 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(u'''<H1>Moved</H1>
87
88 <p>The document has been moved <a href="''')
89         _v = VFFSL(SL,"url",True) # u'$url' on line 5, col 41
90         if _v is not None: write(_filter(_v, rawExpr=u'$url')) # from line 5, col 41.
91         write(u'''">here</a>.</p>
92 ''')
93         
94         ########################################
95         ## END - generated method body
96         
97         return _dummyTrans and trans.response().getvalue() or ""
98         
99     ##################################################
100     ## CHEETAH GENERATED ATTRIBUTES
101
102
103     _CHEETAH__instanceInitialized = False
104
105     _CHEETAH_version = __CHEETAH_version__
106
107     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
108
109     _CHEETAH_genTime = __CHEETAH_genTime__
110
111     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
112
113     _CHEETAH_src = __CHEETAH_src__
114
115     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
116
117     _mainCheetahMethod_for_redirect= u'respond'
118
119 ## END CLASS DEFINITION
120
121 if not hasattr(redirect, '_initCheetahAttributes'):
122     templateAPIClass = getattr(redirect, '_CHEETAH_templateClass', Template)
123     templateAPIClass._addCheetahPlumbingCodeToClass(redirect)
124
125
126 # CHEETAH was developed by Tavis Rudd and Mike Orr
127 # with code, advice and input from many other volunteers.
128 # For more information visit http://www.CheetahTemplate.org/
129
130 ##################################################
131 ## if run from command line:
132 if __name__ == '__main__':
133     from Cheetah.TemplateCmdLineIface import CmdLineIface
134     CmdLineIface(templateObj=redirect()).run()
135
136