Linux worldls-302.fr.planethoster.net 4.18.0-553.8.1.lve.el7h.x86_64 #1 SMP Thu Jul 4 15:19:33 UTC 2024 x86_64
LiteSpeed
Server IP : 10.185.0.203 & Your IP : 216.73.217.14
Domains :
Cant Read [ /etc/named.conf ]
User : gerathty
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
lib64 /
python2.7 /
site-packages /
Cheetah /
Tests /
Delete
Unzip
Name
Size
Permission
Date
Action
Analyzer.py
604
B
-rw-r--r--
2014-01-10 04:44
Analyzer.pyc
1.21
KB
-rw-r--r--
2014-01-10 04:44
Analyzer.pyo
1.21
KB
-rw-r--r--
2014-01-10 04:44
CheetahWrapper.py
18.71
KB
-rw-r--r--
2014-01-10 04:44
CheetahWrapper.pyc
29.16
KB
-rw-r--r--
2014-01-10 04:44
CheetahWrapper.pyo
29.16
KB
-rw-r--r--
2014-01-10 04:44
Cheps.py
1.03
KB
-rw-r--r--
2014-01-10 04:44
Cheps.pyc
1.76
KB
-rw-r--r--
2014-01-10 04:44
Cheps.pyo
1.71
KB
-rw-r--r--
2014-01-10 04:44
Filters.py
1.94
KB
-rw-r--r--
2014-01-10 04:44
Filters.pyc
2.74
KB
-rw-r--r--
2014-01-10 04:44
Filters.pyo
2.57
KB
-rw-r--r--
2014-01-10 04:44
Misc.py
493
B
-rw-r--r--
2014-01-10 04:44
Misc.pyc
1.03
KB
-rw-r--r--
2014-01-10 04:44
Misc.pyo
1.03
KB
-rw-r--r--
2014-01-10 04:44
NameMapper.py
14.62
KB
-rw-r--r--
2014-01-10 04:44
NameMapper.pyc
26.95
KB
-rw-r--r--
2014-01-10 04:44
NameMapper.pyo
26.4
KB
-rw-r--r--
2014-01-10 04:44
Parser.py
1.2
KB
-rw-r--r--
2014-01-10 04:44
Parser.pyc
2.07
KB
-rw-r--r--
2014-01-10 04:44
Parser.pyo
2.07
KB
-rw-r--r--
2014-01-10 04:44
Performance.py
7.15
KB
-rw-r--r--
2014-01-10 04:44
Performance.pyc
9.37
KB
-rw-r--r--
2014-01-10 04:44
Performance.pyo
9.35
KB
-rw-r--r--
2014-01-10 04:44
Regressions.py
8.18
KB
-rw-r--r--
2014-01-10 04:44
Regressions.pyc
9.29
KB
-rw-r--r--
2014-01-10 04:44
Regressions.pyo
8.64
KB
-rw-r--r--
2014-01-10 04:44
SyntaxAndOutput.py
91.28
KB
-rw-r--r--
2014-01-10 04:44
SyntaxAndOutput.pyc
142.79
KB
-rw-r--r--
2014-01-10 04:44
SyntaxAndOutput.pyo
142.38
KB
-rw-r--r--
2014-01-10 04:44
Template.py
12.15
KB
-rw-r--r--
2014-01-10 04:44
Template.pyc
14.54
KB
-rw-r--r--
2014-01-10 04:44
Template.pyo
12.81
KB
-rw-r--r--
2014-01-10 04:44
Test.py
1.48
KB
-rw-r--r--
2014-01-10 04:44
Test.pyc
1.55
KB
-rw-r--r--
2014-01-10 04:44
Test.pyo
1.55
KB
-rw-r--r--
2014-01-10 04:44
Unicode.py
7.13
KB
-rw-r--r--
2014-01-10 04:44
Unicode.pyc
10.78
KB
-rw-r--r--
2014-01-10 04:44
Unicode.pyo
10.12
KB
-rw-r--r--
2014-01-10 04:44
__init__.py
2
B
-rw-r--r--
2014-01-10 04:44
__init__.pyc
147
B
-rw-r--r--
2014-01-10 04:44
__init__.pyo
147
B
-rw-r--r--
2014-01-10 04:44
xmlrunner.py
12.42
KB
-rw-r--r--
2014-01-10 04:44
xmlrunner.pyc
17.48
KB
-rw-r--r--
2014-01-10 04:44
xmlrunner.pyo
17.48
KB
-rw-r--r--
2014-01-10 04:44
Save
Rename
import Cheetah.NameMapper import Cheetah.Template import sys import unittest majorVer, minorVer = sys.version_info[0], sys.version_info[1] versionTuple = (majorVer, minorVer) def isPython23(): ''' Python 2.3 is still supported by Cheetah, but doesn't support decorators ''' return majorVer == 2 and minorVer < 4 class GetAttrException(Exception): pass class CustomGetAttrClass(object): def __getattr__(self, name): raise GetAttrException('FAIL, %s' % name) class GetAttrTest(unittest.TestCase): ''' Test for an issue occurring when __getatttr__() raises an exception causing NameMapper to raise a NotFound exception ''' def test_ValidException(self): o = CustomGetAttrClass() try: print(o.attr) except GetAttrException, e: # expected return except: self.fail('Invalid exception raised: %s' % e) self.fail('Should have had an exception raised') def test_NotFoundException(self): template = ''' #def raiseme() $obj.attr #end def''' template = Cheetah.Template.Template.compile(template, compilerSettings={}, keepRefToGeneratedCode=True) template = template(searchList=[{'obj' : CustomGetAttrClass()}]) assert template, 'We should have a valid template object by now' self.failUnlessRaises(GetAttrException, template.raiseme) class InlineImportTest(unittest.TestCase): def test_FromFooImportThing(self): ''' Verify that a bug introduced in v2.1.0 where an inline: #from module import class would result in the following code being generated: import class ''' template = ''' #def myfunction() #if True #from os import path #return 17 Hello! #end if #end def ''' template = Cheetah.Template.Template.compile(template, compilerSettings={'useLegacyImportMode' : False}, keepRefToGeneratedCode=True) template = template(searchList=[{}]) assert template, 'We should have a valid template object by now' rc = template.myfunction() assert rc == 17, (template, 'Didn\'t get a proper return value') def test_ImportFailModule(self): template = ''' #try #import invalidmodule #except #set invalidmodule = dict(FOO='BAR!') #end try $invalidmodule.FOO ''' template = Cheetah.Template.Template.compile(template, compilerSettings={'useLegacyImportMode' : False}, keepRefToGeneratedCode=True) template = template(searchList=[{}]) assert template, 'We should have a valid template object by now' assert str(template), 'We weren\'t able to properly generate the result from the template' def test_ProperImportOfBadModule(self): template = ''' #from invalid import fail This should totally $fail ''' self.failUnlessRaises(ImportError, Cheetah.Template.Template.compile, template, compilerSettings={'useLegacyImportMode' : False}, keepRefToGeneratedCode=True) def test_AutoImporting(self): template = ''' #extends FakeyTemplate Boo! ''' self.failUnlessRaises(ImportError, Cheetah.Template.Template.compile, template) def test_StuffBeforeImport_Legacy(self): template = ''' ### ### I like comments before import ### #extends Foo Bar ''' self.failUnlessRaises(ImportError, Cheetah.Template.Template.compile, template, compilerSettings={'useLegacyImportMode' : True}, keepRefToGeneratedCode=True) class Mantis_Issue_11_Regression_Test(unittest.TestCase): ''' Test case for bug outlined in Mantis issue #11: Output: Traceback (most recent call last): File "test.py", line 12, in <module> t.respond() File "DynamicallyCompiledCheetahTemplate.py", line 86, in respond File "/usr/lib64/python2.6/cgi.py", line 1035, in escape s = s.replace("&", "&") # Must be done first! ''' def test_FailingBehavior(self): import cgi template = Cheetah.Template.Template("$escape($request)", searchList=[{'escape' : cgi.escape, 'request' : 'foobar'}]) assert template self.failUnlessRaises(AttributeError, template.respond) def test_FailingBehaviorWithSetting(self): import cgi template = Cheetah.Template.Template("$escape($request)", searchList=[{'escape' : cgi.escape, 'request' : 'foobar'}], compilerSettings={'prioritizeSearchListOverSelf' : True}) assert template assert template.respond() class Mantis_Issue_21_Regression_Test(unittest.TestCase): ''' Test case for bug outlined in issue #21 Effectively @staticmethod and @classmethod decorated methods in templates don't properly define the _filter local, which breaks when using the NameMapper ''' def runTest(self): if isPython23(): return template = ''' #@staticmethod #def testMethod() This is my $output #end def ''' template = Cheetah.Template.Template.compile(template) assert template assert template.testMethod(output='bug') # raises a NameError: global name '_filter' is not defined class Mantis_Issue_22_Regression_Test(unittest.TestCase): ''' Test case for bug outlined in issue #22 When using @staticmethod and @classmethod in conjunction with the #filter directive the generated code for the #filter is reliant on the `self` local, breaking the function ''' def test_NoneFilter(self): # XXX: Disabling this test for now return if isPython23(): return template = ''' #@staticmethod #def testMethod() #filter None This is my $output #end filter #end def ''' template = Cheetah.Template.Template.compile(template) assert template assert template.testMethod(output='bug') def test_DefinedFilter(self): # XXX: Disabling this test for now return if isPython23(): return template = ''' #@staticmethod #def testMethod() #filter Filter This is my $output #end filter #end def ''' # The generated code for the template's testMethod() should look something # like this in the 'error' case: ''' @staticmethod def testMethod(**KWS): ## CHEETAH: generated from #def testMethod() at line 3, col 13. trans = DummyTransaction() _dummyTrans = True write = trans.response().write SL = [KWS] _filter = lambda x, **kwargs: unicode(x) ######################################## ## START - generated method body _orig_filter_18517345 = _filter filterName = u'Filter' if self._CHEETAH__filters.has_key("Filter"): _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName] else: _filter = self._CHEETAH__currentFilter = \ self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter write(u' This is my ') _v = VFFSL(SL,"output",True) # u'$output' on line 5, col 32 if _v is not None: write(_filter(_v, rawExpr=u'$output')) # from line 5, col 32. ######################################## ## END - generated method body return _dummyTrans and trans.response().getvalue() or "" ''' template = Cheetah.Template.Template.compile(template) assert template assert template.testMethod(output='bug') if __name__ == '__main__': unittest.main()