zephir.monitor.agentmanager.templates.PageTmpl

Package zephir :: Package monitor :: Package agentmanager :: Package templates :: Module PageTmpl |
[frames] | no frames]

# Source Code for Module zephir.monitor.agentmanager.templates.PageTmpl

      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
     24  ##################################################
     25  ## MODULE CONSTANTS
     26  try:
     27      True, False
     28  except NameError:
     29      True, False = (1==1), (1==0)
     30  VFFSL=valueFromFrameOrSearchList
     31  VFSL=valueFromSearchList
     32  VFN=valueForName
     33  currentTime=time.time
     34  __CHEETAH_version__ = '2.0.1'
     35  __CHEETAH_versionTuple__ = (2, 0, 1, 'final', 0)
     36  __CHEETAH_genTime__ = 1389100488.495331
     37  __CHEETAH_genTimestamp__ = 'Tue Jan  7 14:14:48 2014'
     38  __CHEETAH_src__ = 'PageTmpl.tmpl'
     39  __CHEETAH_srcLastModified__ = 'Tue Jan  7 14:06:55 2014'
     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 PageTmpl(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 head(self, pagetitle, **KWS):
     69
     70
     71
     72          ## CHEETAH: generated from #def head($pagetitle) at line 2, 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('''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     88  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
     89    <head>
     90      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     91      <title>''')
     92          _v = VFFSL(SL,"pagetitle",True) # '$pagetitle' on line 7, col 12
     93          if _v is not None: write(_filter(_v, rawExpr='$pagetitle')) # from line 7, col 12.
     94          write('''</title>
     95      <link rel="stylesheet" href="''')
     96          _v = VFFSL(SL,"static_base",True) # '$static_base' on line 8, col 34
     97          if _v is not None: write(_filter(_v, rawExpr='$static_base')) # from line 8, col 34.
     98          write('''/stylesheet.css" type="text/css" />
     99    </head>
    100
    101    <body>
    102  ''')
    103
    104          ########################################
    105          ## END - generated method body
    106
    107          return _dummyTrans and trans.response().getvalue() or ""
    108
    109
    110 -    def foot(self, **KWS):
    111
    112
    113
    114          ## CHEETAH: generated from #def foot at line 14, col 1.
    115          trans = KWS.get("trans")
    116          if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
    117              trans = self.transaction # is None unless self.awake() was called
    118          if not trans:
    119              trans = DummyTransaction()
    120              _dummyTrans = True
    121          else: _dummyTrans = False
    122          write = trans.response().write
    123          SL = self._CHEETAH__searchList
    124          _filter = self._CHEETAH__currentFilter
    125
    126          ########################################
    127          ## START - generated method body
    128
    129          write('''  </body>
    130  </html>
    131  ''')
    132
    133          ########################################
    134          ## END - generated method body
    135
    136          return _dummyTrans and trans.response().getvalue() or ""
    137
    138
    139 -    def respond(self, trans=None):
    140
    141
    142
    143          ## CHEETAH: main method generated for this template
    144          if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
    145              trans = self.transaction # is None unless self.awake() was called
    146          if not trans:
    147              trans = DummyTransaction()
    148              _dummyTrans = True
    149          else: _dummyTrans = False
    150          write = trans.response().write
    151          SL = self._CHEETAH__searchList
    152          _filter = self._CHEETAH__currentFilter
    153
    154          ########################################
    155          ## START - generated method body
    156
    157          write('''<!-- #encoding utf-8 -->
    158
    159  ''')
    160
    161          ########################################
    162          ## END - generated method body
    163
    164          return _dummyTrans and trans.response().getvalue() or ""
    165
    166      ##################################################
    167      ## CHEETAH GENERATED ATTRIBUTES
    168
    169
    170      _CHEETAH__instanceInitialized = False
    171
    172      _CHEETAH_version = __CHEETAH_version__
    173
    174      _CHEETAH_versionTuple = __CHEETAH_versionTuple__
    175
    176      _CHEETAH_genTime = __CHEETAH_genTime__
    177
    178      _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
    179
    180      _CHEETAH_src = __CHEETAH_src__
    181
    182      _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
    183
    184      _mainCheetahMethod_for_PageTmpl= 'respond'
    185
    186  ## END CLASS DEFINITION
    187
    188  if not hasattr(PageTmpl, '_initCheetahAttributes'):
    189      templateAPIClass = getattr(PageTmpl, '_CHEETAH_templateClass', Template)
    190      templateAPIClass._addCheetahPlumbingCodeToClass(PageTmpl)
    191
    192
    193  # CHEETAH was developed by Tavis Rudd and Mike Orr
    194  # with code, advice and input from many other volunteers.
    195  # For more information visit http://www.CheetahTemplate.org/
    196
    197  ##################################################
    198  ## if run from command line:
    199  if __name__ == '__main__':
    200      from Cheetah.TemplateCmdLineIface import CmdLineIface
    201      CmdLineIface(templateObj=PageTmpl()).run()
    202