Re: [Cheetahtemplate-discuss] [PATCH] Do not print errors to stderr
Brought to you by:
rtyler,
tavis_rudd
From: R. T. B. <ty...@sl...> - 2009-03-27 19:24:24
|
On Fri, Mar 27, 2009 at 03:02:37PM +0100, Jean-Baptiste Quenot wrote: > Here's a patch to fix some annoying cases when Cheetah writes to > stderr, whereas letting the exception propagate is sufficient. I've gone ahead and applied this properly to the next branch. For future patches, I recommend actually committing them to your local git repository and then mailing the "proper" patch so I can just use git-am(1) to apply it. I use a quick little git alias for this: tyler@grapefruit:~/source/github/cheetah> less .git/config | grep mpatch mpatch = !sh -c 'git format-patch $0...$0~ --suffix=.patch.temp && git send-email *.patch.temp $1 && rm *.patch.temp' tyler@grapefruit:~/source/github/cheetah> The use syntax for mailing a patch with this is: tyler@grapefruit:~/source/github/cheetah> git mpatch HEAD # Sends my latest committed patch, HEAD can be any commit hash or tyler@grapefruit:~/source/github/cheetah> git mpatch HEAD --compose # Sends my latest commited patch, but lets me introduce it properly If you use git-send-email(1) like with the 'mpatch' alias above, I can apply your commit properly with git-am(1) (it'll make my life easier :)) Cheers > > diff --git a/src/Parser.py b/src/Parser.py > index 4e9e4db..6f21b57 100644 > --- a/src/Parser.py > +++ b/src/Parser.py > @@ -27,7 +27,6 @@ import time > from tokenize import pseudoprog > import inspect > import new > -import traceback > > from Cheetah.SourceReader import SourceReader > from Cheetah import Filters > diff --git a/src/Template.py b/src/Template.py > index 6112cb6..ecf0f7c 100644 > --- a/src/Template.py > +++ b/src/Template.py > @@ -752,12 +752,8 @@ class Template(Servlet): > > __file__ = os.path.join(cacheDirForModuleFiles, __file__) > # @@TR: might want to assert that it doesn't already exist > - try: > - open(__file__, 'w').write(generatedModuleCode) > - # @@TR: should probably restrict the perms, etc. > - except OSError: > - # @@ TR: should this optionally raise? > - traceback.print_exc(file=sys.stderr) > + open(__file__, 'w').write(generatedModuleCode) > + # @@TR: should probably restrict the perms, etc. > > mod = new.module(str(uniqueModuleName)) > if moduleGlobals: > @@ -779,7 +775,6 @@ class Template(Servlet): > parseError = genParserErrorFromPythonException( > source, file, generatedModuleCode, exception=e) > except: > - traceback.print_exc() > updateLinecache(__file__, generatedModuleCode) > e.generatedModuleCode = generatedModuleCode > raise e > -- > Jean-Baptiste Quenot > http://jbq.caraldi.com/ > > ------------------------------------------------------------------------------ > _______________________________________________ > Cheetahtemplate-discuss mailing list > Che...@li... > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss -- -R. Tyler Ballance Slide, Inc. |