Permalink
Browse files

Merge branch 'next'

  • Loading branch information...
2 parents 7b1c2ad + ffa377c commit a753724d68880488a27141d1e4f174880d39e154 @rtyler rtyler committed Dec 19, 2009
Showing with 9,798 additions and 2,139 deletions.
  1. +9 −0 CHANGES
  2. +4 −3 SetupConfig.py
  3. +9 −15 SetupTools.py
  4. +6 −0 bin/cheetah-analyze
  5. +66 −0 buildandrun
  6. +1 −1 cheetah/CacheRegion.py
  7. +2 −2 cheetah/CacheStore.py
  8. +9 −10 cheetah/CheetahWrapper.py
  9. +64 −78 cheetah/Compiler.py
  10. +98 −0 cheetah/DirectiveAnalyzer.py
  11. +1 −1 cheetah/DummyTransaction.py
  12. +19 −35 cheetah/FileUtils.py
  13. +15 −15 cheetah/Filters.py
  14. +2 −2 cheetah/ImportHooks.py
  15. +15 −39 cheetah/ImportManager.py
  16. +12 −12 cheetah/NameMapper.py
  17. +118 −119 cheetah/Parser.py
  18. +1 −1 cheetah/Servlet.py
  19. +11 −13 cheetah/SettingsManager.py
  20. +3 −16 cheetah/SourceReader.py
  21. +42 −39 cheetah/Template.py
  22. +7 −7 cheetah/TemplateCmdLineIface.py
  23. +15 −15 cheetah/Templates/SkeletonPage.py
  24. +16 −16 cheetah/Templates/_SkeletonPage.py
  25. +29 −0 cheetah/Tests/Analyzer.py
  26. +25 −8 cheetah/Tests/CheetahWrapper.py
  27. +5 −3 cheetah/Tests/Filters.py
  28. +20 −0 cheetah/Tests/Misc.py
  29. +36 −36 cheetah/Tests/NameMapper.py
  30. +49 −0 cheetah/Tests/Parser.py
  31. +8 −8 cheetah/Tests/Performance.py
  32. +1 −1 cheetah/Tests/Regressions.py
  33. +59 −37 cheetah/Tests/SyntaxAndOutput.py
  34. +6 −6 cheetah/Tests/Template.py
  35. +14 −8 cheetah/Tests/Test.py
  36. +40 −1 cheetah/Tests/Unicode.py
  37. +0 −158 cheetah/Tests/VerifyType.py
  38. +0 −978 cheetah/Tests/unittest_local_copy.py
  39. +2 −2 cheetah/Tests/xmlrunner.py
  40. +1 −1 cheetah/Tools/CGITemplate.py
  41. +13 −12 cheetah/Tools/MondoReport.py
  42. +136 −152 cheetah/Tools/SiteHierarchy.py
  43. +4 −4 cheetah/Tools/turbocheetah/cheetahsupport.py
  44. +4 −18 cheetah/Utils/Misc.py
  45. +0 −83 cheetah/Utils/VerifyType.py
  46. +27 −31 cheetah/Utils/memcache.py
  47. +9 −9 cheetah/Utils/statprof.py
  48. +8 −8 cheetah/Version.py
  49. +0 −107 cheetah/c/_verifytype.c
  50. +1 −1 www/conf.py
  51. +6 −0 www/dev_guide/bnf.rst
  52. +404 −0 www/dev_guide/cache.rst
  53. +103 −0 www/dev_guide/comments.rst
  54. +8 −0 www/dev_guide/compiler.rst
  55. +104 −0 www/dev_guide/design.rst
  56. +329 −0 www/dev_guide/errorHandling.rst
  57. +11 −0 www/dev_guide/files.rst
  58. +394 −0 www/dev_guide/flowControl.rst
  59. +94 −0 www/dev_guide/history.rst
  60. +30 −0 www/dev_guide/index.rst
  61. +255 −0 www/dev_guide/inheritanceEtc.rst
  62. +28 −0 www/dev_guide/introduction.rst
  63. +315 −0 www/dev_guide/output.rst
  64. +9 −0 www/dev_guide/parser.rst
  65. +67 −0 www/dev_guide/parserInstructions.rst
  66. +149 −0 www/dev_guide/patching.rst
  67. +489 −0 www/dev_guide/placeholders.rst
  68. +252 −0 www/dev_guide/pyModules.rst
  69. +40 −0 www/dev_guide/safeDelegation.rst
  70. +11 −0 www/dev_guide/template.rst
  71. +1 −3 www/documentation.rst
  72. +5 −5 www/download.rst
  73. +4 −2 www/index.rst
  74. +9 −18 www/roadmap.rst
  75. +101 −0 www/users_guide/comments.rst
  76. +515 −0 www/users_guide/comparisons.rst
  77. +37 −0 www/users_guide/editors.rst
  78. +144 −0 www/users_guide/errorHandling.rst
  79. +27 −0 www/users_guide/examples.rst
  80. +436 −0 www/users_guide/flowControl.rst
  81. +278 −0 www/users_guide/gettingStarted.rst
  82. +99 −0 www/users_guide/glossary.rst
  83. 0 www/users_guide/howItWorks.rst
  84. +28 −0 www/users_guide/index.rst
  85. +517 −0 www/users_guide/inheritanceEtc.rst
  86. +313 −0 www/users_guide/intro.rst
  87. +741 −0 www/users_guide/language.rst
  88. +315 −0 www/users_guide/libraries.rst
  89. +142 −0 www/users_guide/links.rst
  90. +16 −0 www/users_guide/nonHtml.rst
  91. +48 −0 www/users_guide/optikLicense.rst
  92. +101 −0 www/users_guide/otherHtml.rst
  93. +468 −0 www/users_guide/output.rst
  94. +129 −0 www/users_guide/parserInstructions.rst
  95. +586 −0 www/users_guide/tipsAndTricks.rst
  96. +598 −0 www/users_guide/webware.rst
View
@@ -1,3 +1,12 @@
+2.4.1 (December 19th, 2009)
+ - --quiet flag added to `cheetah` to silence printing to stdout (abbeyj)
+ - Refactoring to minimize the amount of forked code for Python3 (rtyler)
+ - Template.compile() will no longer create class names with numerous leading
+ underscores (rtyler; reported by Kirill Uhanov)
+ - DirectiveAnalyzer (cheetah-analyze script) added to report directive usage in templates (rtyler)
+ - Older LaTeX docs converted to rst for Sphinx (rtyler)
+ - Prevent #raw blocks from evaluating $-placeholders and escaped strings (karmix0)
+ - New tests added to verify PSP behavior and other untested internals (rtyler)
2.4.0 (October 24th, 2009)
- Fix a major performance regression in Template.__init__()
View
@@ -49,9 +49,10 @@
]
## Data Files and Scripts
-scripts = ['bin/cheetah-compile',
+scripts = ('bin/cheetah-compile',
'bin/cheetah',
- ]
+ 'bin/cheetah-analyze',
+ )
data_files = ['recursive: cheetah *.tmpl *.txt LICENSE README TODO CHANGES',]
@@ -71,7 +72,7 @@
]
}
except ImportError:
- print 'Not using setuptools, so we cannot install the Markdown dependency'
+ print('Not using setuptools, so we cannot install the Markdown dependency')
description = "Cheetah is a template engine and code generation tool."
View
@@ -77,8 +77,8 @@ def run (self):
data_files = self.get_inputs()
for entry in data_files:
- if type(entry) != types.StringType:
- raise ValueError, 'The entries in "data_files" must be strings'
+ if not isinstance(entry, basestring):
+ raise ValueError('The entries in "data_files" must be strings')
entry = string.join(string.split(entry, '/'), os.sep)
# entry is a filename or glob pattern
@@ -137,13 +137,7 @@ def run_setup(configurations):
for configuration in configurations:
kws.update(vars(configuration))
for name, value in kws.items():
- if name[:1] == '_' or \
- type(value) not in (types.StringType,
- types.ListType,
- types.TupleType,
- types.DictType,
- types.IntType,
- ):
+ if name[:1] == '_' or not isinstance(value, (basestring, list, tuple, dict, int)):
del kws[name]
# Add setup extensions
@@ -158,14 +152,14 @@ def run_setup(configurations):
try:
apply(setup, (), kws)
except BuildFailed, x:
- print "One or more C extensions failed to build."
- print "Details: %s" % x
- print "Retrying without C extensions enabled."
+ print("One or more C extensions failed to build.")
+ print("Details: %s" % x)
+ print("Retrying without C extensions enabled.")
del kws['ext_modules']
apply(setup, (), kws)
- print "One or more C extensions failed to build."
- print "Performance enhancements will not be available."
- print "Pure Python installation succeeded."
+ print("One or more C extensions failed to build.")
+ print("Performance enhancements will not be available.")
+ print("Pure Python installation succeeded.")
View
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+from Cheetah import DirectiveAnalyzer
+
+if __name__ == '__main__':
+ DirectiveAnalyzer.main()
View
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+import logging
+import os
+import os.path
+import subprocess
+import sys
+
+from optparse import OptionParser
+
+if os.getenv('DEBUG'):
+ logging.basicConfig(level=logging.DEBUG)
+
+def recursiverm(d):
+ for root, dirs, files in os.walk(d):
+ for f in files:
+ f = root + os.path.sep + f
+ logging.debug('Removing file: %s' % f)
+ os.unlink(f)
+
+def main():
+ op = OptionParser()
+ op.add_option('-c', '--clean', dest='clean', action='store_true',
+ help='Remove the contents of the build directory')
+ opts, args = op.parse_args()
+ if not args:
+ print('Specify a test script')
+ return
+
+
+ if opts.clean:
+ logging.debug('Removing build/')
+ recursiverm('build')
+
+ logging.debug('Building Cheetah')
+ rc = subprocess.call(('python', 'setup.py', 'build'))
+
+ if rc:
+ logging.debug('Build failed!')
+ return
+
+ logging.debug('Adjusting PATH and PYTHONPATH')
+ cwd = os.getcwd()
+
+ libdir = None
+ scriptdir = None
+
+ for sub in os.listdir('build'):
+ if sub.startswith('scripts'):
+ scriptdir = os.path.sep.join((cwd, 'build', sub))
+ if sub.startswith('lib'):
+ libdir = os.path.sep.join((cwd, 'build', sub))
+
+ newpath = '%s:%s' % (scriptdir, os.getenv('PATH'))
+ logging.debug('Setting PATH to: %s' % newpath)
+ os.putenv('PATH', newpath)
+ logging.debug('Setting PYTHONPATH to: %s' % libdir)
+ os.putenv('PYTHONPATH', libdir)
+
+ rc = subprocess.call( ['python',] + args )
+
+
+
+if __name__ == '__main__':
+ main()
+
View
@@ -128,7 +128,7 @@ def getCacheItem(self, cacheItemID):
"""
cacheItemID = md5(str(cacheItemID)).hexdigest()
- if not self._cacheItems.has_key(cacheItemID):
+ if cacheItemID not in self._cacheItems:
cacheItem = self._cacheItemClass(
cacheItemID=cacheItemID, cacheStore=self._wrappedCacheDataStore)
self._cacheItems[cacheItemID] = cacheItem
View
@@ -46,12 +46,12 @@ def set(self, key, val, time=0):
self._data[key] = (val, time)
def add(self, key, val, time=0):
- if self._data.has_key(key):
+ if key in self._data:
raise Error('a value for key %r is already in the cache'%key)
self._data[key] = (val, time)
def replace(self, key, val, time=0):
- if self._data.has_key(key):
+ if key in self._data:
raise Error('a value for key %r is already in the cache'%key)
self._data[key] = (val, time)
View
@@ -161,7 +161,8 @@ def parseOpts(self, args):
pao("--iext", action="store", dest="iext", default=".tmpl", help='File input extension (defaults: compile: .tmpl, fill: .tmpl)')
pao("--oext", action="store", dest="oext", default=defaultOext, help='File output extension (defaults: compile: .py, fill: .html)')
pao("-R", action="store_true", dest="recurse", default=False, help='Recurse through subdirectories looking for input files')
- pao("--stdout", "-p", action="store_true", dest="stdout", default=False, help='Verbosely print informational messages to stdout')
+ pao("--stdout", "-p", action="store_true", dest="stdout", default=False, help='Send output to stdout instead of writing to a file')
+ pao("--quiet", action="store_false", dest="verbose", default=True, help='Do not print informational messages to stdout')
pao("--debug", action="store_true", dest="debug", default=False, help='Print diagnostic/debug information to stderr')
pao("--env", action="store_true", dest="env", default=False, help='Pass the environment into the search list')
pao("--pickle", action="store", dest="pickle", default="", help='Unpickle FILE and pass it through in the search list')
@@ -194,14 +195,14 @@ def parseOpts(self, args):
if opts.print_settings:
- print
- print '>> Available Cheetah compiler settings:'
+ print()
+ print('>> Available Cheetah compiler settings:')
from Cheetah.Compiler import _DEFAULT_COMPILER_SETTINGS
listing = _DEFAULT_COMPILER_SETTINGS
listing.sort(key=lambda l: l[0][0].lower())
for l in listing:
- print '\t%s (default: "%s")\t%s' % l
+ print('\t%s (default: "%s")\t%s' % l)
sys.exit(0)
#cleanup trailing path separators
@@ -222,7 +223,6 @@ def parseOpts(self, args):
unpickled = pickle.load(f)
f.close()
self.searchList.insert(0, unpickled)
- opts.verbose = not opts.stdout
##################################################
## COMMAND METHODS
@@ -266,7 +266,7 @@ def test(self):
runner.run(unittest.TestSuite(Test.suites))
def version(self):
- print Version
+ print(Version)
# If you add a command, also add it to the 'meths' variable in main().
@@ -387,12 +387,11 @@ def _checkForCollisions(self, bundles):
isError = False
dstSources = {}
for b in bundles:
- if dstSources.has_key(b.dst):
+ if b.dst in dstSources:
dstSources[b.dst].append(b.src)
else:
dstSources[b.dst] = [b.src]
- keys = dstSources.keys()
- keys.sort()
+ keys = sorted(dstSources.keys())
for dst in keys:
sources = dstSources[dst]
if len(sources) > 1:
@@ -537,7 +536,7 @@ def getkws(**kws):
return kws
if self.opts.compilerSettingsString:
try:
- exec 'settings = getkws(%s)'%self.opts.compilerSettingsString
+ exec('settings = getkws(%s)'%self.opts.compilerSettingsString)
except:
self.error("There's an error in your --settings option."
"It must be valid Python syntax.\n"
Oops, something went wrong.

0 comments on commit a753724

Please sign in to comment.