I'm deets. And the initial patch that was proposed is broken, precisely
because of the non-working version comparison.
A few month ago this was discussed between me and cd34 here, but I wasn't sure
which of the diffs which floated around was actually working.
If one of you guys sorts that out, I'm all happy releasing a new TW version to
PyPI.
Diez
Even worse, there is already Pylons 0.11.x, so string comparisons of
that version number is really not appropriate. Instead, check for the
feature that may be mssing. I.e. instead of:
if pylons.__version__ > '0.9.7':
__all__ = ["PylonsHostFramework", "validate", "render", "valid"]
else:
__all__ = ["PylonsHostFramework", "validate", "render_response",
"render", "valid"]
do this:
__all__ = ["PylonsHostFramework", "validate", "render", "valid"]
try:
from pylons.templating import render_response
except ImportError: # Pylons >= 1.0
render_response = None
if render_response:
__all__.append('render_response')
In the rest of the patch you can then simply say "if not
render_response" instead of checking for "pylons.__version__ > '0.9.7'".
This is much more readable and will not break no matter when 0.12 comes
out, not matter whether it has render_response or not.
-- Christoph
On 12 Jul 2010, at 14:11, Paul Johnston wrote:
> Hi,
>
> The patch looks ok. Doing this:
>
> if pylons.__version__ > '0.9.7':
>
> Isn't ideal, as it wouldn't work for Pylons 0.9.11, but I think it's
> good enough for now.
I adopted Diez' more intelligent version test...
http://bitbucket.org/gjhiggins/tw-pylons/changeset/491783bc9916
- --
Cheers,
Graham
http://www.linkedin.com/in/ghiggins
-----BEGIN PGP SIGNATURE-----
iEYEARECAAYFAkw7FZcACgkQOsmLt1Nhivy4lwCfdCi3leO3CyDYnVcoVyFO1+/3
5i0AoO7Uec7+GtcSNm74cln6pLELonj2iQCUAgUBTDsVl1nrWVZ7aXD1AQLYSAP4
5VEQAYIEAL+/bYqpMtVttTZlyhSr7Mgeo3tpcvdt6DC3ojXMDre9gWclk9Kc/l+B
Ybyx1XLjvs2+P2ww/EDweShRskrDglHz2VJE3Xo1n330dyTu2iT5wrs3rK56XVrM
rWnAhx6m8lAuBcItg1tMXEMXQXZXauVgqJ8gYUvI0w==
=W42a
-----END PGP SIGNATURE-----
On 12 Jul 2010, at 14:44, Christoph Zwerschke wrote:
> check for the feature that may be mssing.
> [..]
> In the rest of the patch you can then simply say "if not
> render_response" instead of checking for "pylons.__version__ >
> '0.9.7'".
> This is much more readable and will not break no matter when 0.12
> comes
> out, not matter whether it has render_response or not.
That's what I chose to do when setuptools' bizarro version arithmetic
was drawn to my attention. Then, when Diez posted what was obviously
the Right Way To Do It, I switched to that.
Elsewhere:
> Graham said that the ML doesn't seem to work for him
spam-blocked, I suspect, otherwise web form submission of posts would
work for me and it doesn't. I have unsubbed and re-subbed using a
different email address.
Testing, testing, 1, 2, 3...
- --
Cheers,
Graham
http://www.linkedin.com/in/ghiggins
-----BEGIN PGP SIGNATURE-----
iEYEARECAAYFAkw8deQACgkQOsmLt1NhivxAXACfen/j7DWTabBOnvDS1VifC3x3
oi8An1MiyMAATn8KQo/puq3PJGtm7x9TiQCVAgUBTDx15FnrWVZ7aXD1AQI0cgP8
DKgTihj2STVW99u4D4IRpqi9cI+dH5041QzBy4Oh2aFCzK/m3oGDM2nQ+l/dpR0P
TzEvhK90Pbrm72w0x3FTT8BSzRxhadcUpbpKL/ZwQOwxgMbSpQ6WFxfGBVaGqwMG
BUsGcEiUhHbRQ99pvJ5RzOg9fCRVqD3WMT2nVJ3f8tU=
=VjY7
-----END PGP SIGNATURE-----