Hi Jakub,

On Nov 30, 2010, at 08:48 PM, Jakub Wilk wrote:

>I'm not maintainer of this package, but...
>
>* Barry Warsaw <ba...@python.org>, 2010-11-29, 15:05:
>>Package: cheetah
>>Version: 2.4.3
>
>There is no such version in Debian:
>$ rmadison cheetah
>      cheetah | 2.0~rc7-1 | etch    | source
>      cheetah | 2.0.1-2   | lenny   | source
>      cheetah | 2.4.2.1-1 | squeeze | source
>      cheetah | 2.4.2.1-1 | sid     | source

Ah, right sorry about that.  Ubuntu has 2.4.3 and I forgot to check the
version in Debian when I submitted the bug report.  Upstream released Cheetah
2.4.3 on 2010-09-16 so Debian should update, though that's probably not
immediately necessary (i.e. maybe it can wait until Squeeze is released).

http://pypi.python.org/pypi/Cheetah/2.4.3

But oddly enough, both the online change log and in-tarball change log only
go up to 2.4.2:

http://www.cheetahtemplate.org/CHANGES.txt

I have no idea why that is.

>>02_clean_modules.patch and 03_python-2.6-warning-fix.patch are no >longer 
>>necessary.
>
>The latest version of cheetah in Debian doesn't carry any of these patches 
>AFAICS.

Cool.  I'm betting they were necessary for 2.0.x but not 2.4.x.

>>diff -uNr Cheetah-2.4.2.1.orig/cheetah/Template.py 
>>Cheetah-2.4.2.1/cheetah/Template.py
>>--- Cheetah-2.4.2.1.orig/cheetah/Template.py  2010-02-07 23:17:23.000000000 
>>-0500
>>+++ Cheetah-2.4.2.1/cheetah/Template.py       2010-10-18 14:06:54.439935114 
>>-0400
>>@@ -32,7 +32,7 @@
>> > filetype = None
>> >-if isinstance(sys.version_info, tuple):
>>+if isinstance(sys.version_info[:], tuple):
>>     # Python 2.xx
>>     filetype = types.FileType
>>     def createMethod(func, cls):
>
>This hunk looks good, as sys.version_info is not a tuple in Python 2.7. (Don't 
>ask me why...)

Heh, it became a namedtuple, presumably for readability:

% python2.7
Python 2.7.0+ (r27:82500, Sep 15 2010, 18:14:55) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> type(sys.version_info)
<type 'sys.version_info'>
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=0, releaselevel='final', serial=0)
>>> sys.version_info.minor
7
>>> sys.version_info[1]
7
>>> type(sys.version_info[:])
<type 'tuple'>
>>>

Anyway, this is the fix suggested in

https://github.com/rtyler/cheetah/issues/#issue/2

>>diff -uNr Cheetah-2.4.2.1.orig/cheetah/Tests/SyntaxAndOutput.py 
>>Cheetah-2.4.2.1/cheetah/Tests/SyntaxAndOutput.py
>>--- Cheetah-2.4.2.1.orig/cheetah/Tests/SyntaxAndOutput.py     2010-10-18 
>>15:00:44.668935001 -0400
>>+++ Cheetah-2.4.2.1/cheetah/Tests/SyntaxAndOutput.py  2010-10-18 
>>14:43:56.500934997 -0400
>>@@ -847,17 +847,17 @@
>>     def test10(self):
>>         r"""func placeholder - with ('''\nstring\n''')"""
>>         self.verify("$aFunc('''\naoeu\n''')",
>>-                    "\naoeu\n")
>>+                    "\naoeu\n", convertEOLs=False)
>> >     def test11(self):
>>         r"""func placeholder - with ('''\nstring'\n''')"""
>>         self.verify("$aFunc('''\naoeu'\n''')",
>>-                    "\naoeu'\n")
>>+                    "\naoeu'\n", convertEOLs=False)
>> >     def test12(self):
>>         r'''func placeholder - with ("""\nstring\n""")'''
>>         self.verify('$aFunc("""\naoeu\n""")',
>>-                    "\naoeu\n")
>>+                    "\naoeu\n", convertEOLs=False)
>> >     def test13(self):
>>         """func placeholder - with (string*int)"""
>
>This one looks wrong. I believe that the tests were correct and the bug is 
>somewhere else.

Given the upstream bug report, this doesn't seem like a totally unreasonable
way to solve the bug across Python 2.6 and 2.7 for now.  I haven't looked at
the code though.  Also note that this was a fairly straight rip from the
Fedora patch.  It's probably fine until upstream fixes it for real.

Cheers,
-Barry

Attachment: signature.asc
Description: PGP signature

Reply via email to