[Paste] Skipping files in paster templates

2007-11-08 Thread Christoph Zwerschke
TurboGears uses paste.script for its quickstart command. There was a request that a file ("sqlobject.txt") is skipped in one template if a certain variable ("sqlobject") is not set. How could this be realized? My first idea was to change the file name to "+sqlobject_txt+" and then set the varia

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Ian Bicking
Christoph Zwerschke wrote: > TurboGears uses paste.script for its quickstart command. There was a > request that a file ("sqlobject.txt") is skipped in one template if a > certain variable ("sqlobject") is not set. > > How could this be realized? My first idea was to change the file name to > "

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Christoph Zwerschke
Ian Bicking wrote: >> Or is there a better way to skip individual files? > > Yes, in the template itself you can do skip_template(), which raises an > exception that tells copydir to skip the file. Thanks a lot. That is a really useful feature. However, when I tried this, I got the following tr

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Christoph Zwerschke
Ian Bicking wrote: > That fix is in trunk now. What kind of exception is it exactly? It > would have to have a .args of (), as no .args won't trigger this case. I > have code that uses skip_template() and it works fine. Unless maybe I > haven't tested it on Python 2.5, and something changed t

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Ian Bicking
Christoph Zwerschke wrote: > Ian Bicking wrote: >> That fix is in trunk now. What kind of exception is it exactly? It >> would have to have a .args of (), as no .args won't trigger this case. I >> have code that uses skip_template() and it works fine. Unless maybe I >> haven't tested it on Py

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Ian Bicking
Christoph Zwerschke wrote: > Ian Bicking wrote: >>> Or is there a better way to skip individual files? >> Yes, in the template itself you can do skip_template(), which raises an >> exception that tells copydir to skip the file. > > Thanks a lot. That is a really useful feature. > > However, when

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Christoph Zwerschke
Ian Bicking wrote: > Well, in trunk it'll work fine irregardless. To be compatible with the > release, if you raise SkipTemplate('skip file'), it should work now. It > must be something about the nesting that causes the problem, where it > isn't always there. But I guess I will have to use Ch

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Ian Bicking
Christoph Zwerschke wrote: > Ian Bicking wrote: >> What was the actual exception object involved? The error you saw came >> from the error handler, so there's some other exception being raised, >> right? > > It was only the SkipTemplate exception. This exception was caught in > substitute_cont

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Ian Bicking
Christoph Zwerschke wrote: > Ian Bicking wrote: >> Well, in trunk it'll work fine irregardless. To be compatible with the >> release, if you raise SkipTemplate('skip file'), it should work now. It >> must be something about the nesting that causes the problem, where it >> isn't always there. >

Re: [Paste] Skipping files in paster templates

2007-11-08 Thread Christoph Zwerschke
Ian Bicking wrote: > What was the actual exception object involved? The error you saw came > from the error handler, so there's some other exception being raised, > right? It was only the SkipTemplate exception. This exception was caught in substitute_content(), where the _add_except() tried t