Cheetah completely borked under python 2.7?

View: New views
7 Messages — Rating Filter:   Alert me  

Cheetah completely borked under python 2.7?

by Mike Bonnet :: Rate this Message:

| View Threaded | Show Only this Message

I just built Cheetah and ran the unit tests under python 2.7 (Fedora 14
Beta) and it spewed a ton of errors.  I haven't had a chance to look
into them yet, but they look pretty concerning.  Has anyone seen these
problems yet?  Are we going to need serious refactoring to make Cheetah
work under python 2.7?

The log is available here:

http://people.redhat.com/mikeb/cheetah-2.4.3-python27-tests.log

I'll start looking into possible fixes when I can.

Thanks,
Mike

------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security
easier or more difficult to achieve? Read this whitepaper to separate the
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Cheetah completely borked under python 2.7?

by R. Tyler Ballance :: Rate this Message:

| View Threaded | Show Only this Message


On Mon, 04 Oct 2010, Mike Bonnet wrote:

> I just built Cheetah and ran the unit tests under python 2.7 (Fedora 14
> Beta) and it spewed a ton of errors.  I haven't had a chance to look
> into them yet, but they look pretty concerning.  Has anyone seen these
> problems yet?  Are we going to need serious refactoring to make Cheetah
> work under python 2.7?
>
> The log is available here:
>
> http://people.redhat.com/mikeb/cheetah-2.4.3-python27-tests.log
>
> I'll start looking into possible fixes when I can.
Yes, this is something I've known about for a few weeks but still haven't had
the time to install Python 2.7 to even sit down and assess the situation :-/

If you have the bandwidth, I'd gladly accept some patches and push out a new
release (I've historically been using Cheetah with older/more stable versions
of Python).

- R. Tyler Croy
--------------------------------------
  GitHub: http://github.com/rtyler
 Twitter: http://twitter.com/agentdero



------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security
easier or more difficult to achieve? Read this whitepaper to separate the
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

attachment0 (205 bytes) Download Attachment

Re: Cheetah completely borked under python 2.7?

by Jon Siddle :: Rate this Message:

| View Threaded | Show Only this Message

  I've spent a little time trying to track this down, and while I
haven't quite pinned it down, I do have some more information. I've only
looked into the __dict__ errors.

* The problem seems to be with specifying a base class (changing
{'baseclass': dict} to {'baseclass': "Template"} in SyntaxAndOutput.py
fixes those tests).
* Changing the base class to the following in that same file also fixes
the problem:

class MyClass(object):
   def __init__(*args, **kwargs):
     pass
   def shutdown(self):
     pass
extraCompileKwArgsForDiffBaseclass = {'baseclass': MyClass}

Any class with a shutdown method seems to work, otherwise the shutdown
method from Template is called. I can't actually see how Template's
shutdown method is
being called. Someone who knows this might be able to see what's wrong here.

It doesn't look like it would be too hard to fix for someone who knows
the codebase.

Has anyone else got any further with this?

Thanks

Jon

On 04/10/10 21:26, Mike Bonnet wrote:

> I just built Cheetah and ran the unit tests under python 2.7 (Fedora 14
> Beta) and it spewed a ton of errors.  I haven't had a chance to look
> into them yet, but they look pretty concerning.  Has anyone seen these
> problems yet?  Are we going to need serious refactoring to make Cheetah
> work under python 2.7?
>
> The log is available here:
>
> http://people.redhat.com/mikeb/cheetah-2.4.3-python27-tests.log
>
> I'll start looking into possible fixes when I can.
>
> Thanks,
> Mike
>
> ------------------------------------------------------------------------------
> Virtualization is moving to the mainstream and overtaking non-virtualized
> environment for deploying applications. Does it make network security
> easier or more difficult to achieve? Read this whitepaper to separate the
> two and get a better understanding.
> http://p.sf.net/sfu/hp-phase2-d2d
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Cheetah completely borked under python 2.7?

by Jon Siddle :: Rate this Message:

| View Threaded | Show Only this Message

   There are 35 errors caused by a python version check which breaks
under 2.7

See attached for a simple patch to fix it.

More details about the change in 2.7 which broke it here:
http://bugs.python.org/issue4285

Thanks

Jon
On 04/10/10 21:26, Mike Bonnet wrote:

> I just built Cheetah and ran the unit tests under python 2.7 (Fedora 14
> Beta) and it spewed a ton of errors.  I haven't had a chance to look
> into them yet, but they look pretty concerning.  Has anyone seen these
> problems yet?  Are we going to need serious refactoring to make Cheetah
> work under python 2.7?
>
> The log is available here:
>
> http://people.redhat.com/mikeb/cheetah-2.4.3-python27-tests.log
>
> I'll start looking into possible fixes when I can.
>
> Thanks,
> Mike
>
> ------------------------------------------------------------------------------
> Virtualization is moving to the mainstream and overtaking non-virtualized
> environment for deploying applications. Does it make network security
> easier or more difficult to achieve? Read this whitepaper to separate the
> two and get a better understanding.
> http://p.sf.net/sfu/hp-phase2-d2d
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


>From d36aeb8cc36ff7e0bc92663312a8e32dcbf2ef27 Mon Sep 17 00:00:00 2001
From: Jon Siddle <js@...>
Date: Tue, 12 Oct 2010 13:37:06 +0100
Subject: [PATCH] sys.version_info isn't a tuple in 2.7. Fix version check in Template.py

---
 cheetah/Template.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cheetah/Template.py b/cheetah/Template.py
index f42f77b..10ced89 100644
--- a/cheetah/Template.py
+++ b/cheetah/Template.py
@@ -32,7 +32,7 @@ except ImportError:
 
 filetype = None
 
-if isinstance(sys.version_info, tuple):
+if isinstance(sys.version_info[:], tuple):
     # Python 2.xx
     filetype = types.FileType
     def createMethod(func, cls):
--
1.7.2.3



------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Cheetah completely borked under python 2.7?

by Jon Siddle :: Rate this Message:

| View Threaded | Show Only this Message

  The remaining failures (6 of them) are line endings tests. Python 2.7
changed the behaviour of the compile() builtin (change documented
at http://docs.python.org/dev/whatsnew/2.7.html). The following
minimally reproduces the change:

c = compile('x="""\r\nx\r\n"""', 'file', 'exec')
exec(c, globals(), locals())

print x == "\nx\n"

Under 2.7 this prints "True". Under earlier versions of python, it prints
"False".

I can't see a way round this short of replacing all in-string literal
newlines
with "\r\n" or "\r". This would require pre-parsing the template to find
the strings. Hopefully there's a nicer way.

We don't actually care that literal line endings get converted to UNIX
line endings; does this matter to anyone? Would it be easier to require
non-UNIX line endings to be escaped?

Thanks

Jon

On 04/10/10 21:26, Mike Bonnet wrote:

> I just built Cheetah and ran the unit tests under python 2.7 (Fedora 14
> Beta) and it spewed a ton of errors.  I haven't had a chance to look
> into them yet, but they look pretty concerning.  Has anyone seen these
> problems yet?  Are we going to need serious refactoring to make Cheetah
> work under python 2.7?
>
> The log is available here:
>
> http://people.redhat.com/mikeb/cheetah-2.4.3-python27-tests.log
>
> I'll start looking into possible fixes when I can.
>
> Thanks,
> Mike
>
> ------------------------------------------------------------------------------
> Virtualization is moving to the mainstream and overtaking non-virtualized
> environment for deploying applications. Does it make network security
> easier or more difficult to achieve? Read this whitepaper to separate the
> two and get a better understanding.
> http://p.sf.net/sfu/hp-phase2-d2d
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Cheetah completely borked under python 2.7?

by Mike Bonnet :: Rate this Message:

| View Threaded | Show Only this Message

On 10/12/2010 09:01 AM, Jon Siddle wrote:
>   There are 35 errors caused by a python version check which breaks
> under 2.7
>
> See attached for a simple patch to fix it.
>
> More details about the change in 2.7 which broke it here:
> http://bugs.python.org/issue4285

Great job tracking this down Jon.  I've applied your patch and rebuilt
Cheetah for Fedora:

http://pkgs.fedoraproject.org/gitweb/?p=python-cheetah.git;a=commit;h=HEAD
http://koji.fedoraproject.org/koji/buildinfo?buildID=200978

cheetah-2.4-python2.7-compat.patch also turns off convertEOLs on 3 tests
that were failing because of changes to the compile(), as you noted in
your other message.  Not sure if there's a better way to handle it, but
for now this allows the tests to pass.

The two other patches fix a warning from setuptools, and cause "cheetah
test" to return with a non-zero exit code when tests are failing.  Worth
picking up for the next release?

Thanks,
Mike

> Thanks
>
> Jon
> On 04/10/10 21:26, Mike Bonnet wrote:
>> I just built Cheetah and ran the unit tests under python 2.7 (Fedora 14
>> Beta) and it spewed a ton of errors.  I haven't had a chance to look
>> into them yet, but they look pretty concerning.  Has anyone seen these
>> problems yet?  Are we going to need serious refactoring to make Cheetah
>> work under python 2.7?
>>
>> The log is available here:
>>
>> http://people.redhat.com/mikeb/cheetah-2.4.3-python27-tests.log
>>
>> I'll start looking into possible fixes when I can.
>>
>> Thanks,
>> Mike
>>
>> ------------------------------------------------------------------------------
>>
>> Virtualization is moving to the mainstream and overtaking non-virtualized
>> environment for deploying applications. Does it make network security
>> easier or more difficult to achieve? Read this whitepaper to separate the
>> two and get a better understanding.
>> http://p.sf.net/sfu/hp-phase2-d2d
>> _______________________________________________
>> Cheetahtemplate-discuss mailing list
>> Cheetahtemplate-discuss@...
>> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>
>
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
>
>
>
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Cheetah completely borked under python 2.7?

by R. Tyler Ballance :: Rate this Message:

| View Threaded | Show Only this Message


On Tue, 19 Oct 2010, Mike Bonnet wrote:

> On 10/12/2010 09:01 AM, Jon Siddle wrote:
> >   There are 35 errors caused by a python version check which breaks
> > under 2.7
> >
> > See attached for a simple patch to fix it.
> >
> > More details about the change in 2.7 which broke it here:
> > http://bugs.python.org/issue4285
>
> Great job tracking this down Jon.  I've applied your patch and rebuilt
> Cheetah for Fedora:
>
> http://pkgs.fedoraproject.org/gitweb/?p=python-cheetah.git;a=commit;h=HEAD
> http://koji.fedoraproject.org/koji/buildinfo?buildID=200978
>
> cheetah-2.4-python2.7-compat.patch also turns off convertEOLs on 3 tests
> that were failing because of changes to the compile(), as you noted in
> your other message.  Not sure if there's a better way to handle it, but
> for now this allows the tests to pass.
>
> The two other patches fix a warning from setuptools, and cause "cheetah
> test" to return with a non-zero exit code when tests are failing.  Worth
> picking up for the next release?

If there's no objections, I might just move the tests over to nose so we can do
proper test skipping.


>
> Thanks,
> Mike
>
> > Thanks
> >
> > Jon
> > On 04/10/10 21:26, Mike Bonnet wrote:
> >> I just built Cheetah and ran the unit tests under python 2.7 (Fedora 14
> >> Beta) and it spewed a ton of errors.  I haven't had a chance to look
> >> into them yet, but they look pretty concerning.  Has anyone seen these
> >> problems yet?  Are we going to need serious refactoring to make Cheetah
> >> work under python 2.7?
> >>
> >> The log is available here:
> >>
> >> http://people.redhat.com/mikeb/cheetah-2.4.3-python27-tests.log
> >>
> >> I'll start looking into possible fixes when I can.
> >>
> >> Thanks,
> >> Mike
> >>
> >> ------------------------------------------------------------------------------
> >>
> >> Virtualization is moving to the mainstream and overtaking non-virtualized
> >> environment for deploying applications. Does it make network security
> >> easier or more difficult to achieve? Read this whitepaper to separate the
> >> two and get a better understanding.
> >> http://p.sf.net/sfu/hp-phase2-d2d
> >> _______________________________________________
> >> Cheetahtemplate-discuss mailing list
> >> Cheetahtemplate-discuss@...
> >> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
> >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Beautiful is writing same markup. Internet Explorer 9 supports
> > standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> > Spend less time writing and  rewriting code and more time creating great
> > experiences on the web. Be a part of the beta today.
> > http://p.sf.net/sfu/beautyoftheweb
> >
> >
> >
> > _______________________________________________
> > Cheetahtemplate-discuss mailing list
> > Cheetahtemplate-discuss@...
> > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>
>
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
- R. Tyler Croy
--------------------------------------
  GitHub: http://github.com/rtyler
 Twitter: http://twitter.com/agentdero



------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

attachment0 (205 bytes) Download Attachment