WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

unicode/encoding issues

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

unicode/encoding issues

by Богун Дмитрий :: Rate this Message:

| View Threaded | Show Only this Message

One more issue with not ascii letters in template.

$ cat test.tmpl
#encofing utf-8
##attr test = u'не ascii параметр'
#attr test = u'не ascii параметр'
test
$ cheetah-compile test.tmpl
Compiling test.tmpl -> test.py
Traceback (most recent call last):
  File "/usr/bin/cheetah-compile-2.6", line 3, in <module>
    _cheetah_compile()
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 625, in _cheetah_compile
    CheetahWrapper().main()
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 148, in main
    meth()
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 231, in compile
    self._compileOrFill()
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 380, in _compileOrFill
    self._compileOrFillBundle(b)
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 596, in _compileOrFillBundle
    compilerSettings=compilerSettings)
  File "/usr/lib/python2.6/site-packages/Cheetah/Template.py", line 740, in compile
    settings=(compilerSettings or {}))
  File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1575, in __init__
    source = unicode(source)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 32: ordinal not in range(128)

How can I assing not ascii string in #attr directive?


------------------------------------------------------------------------------
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/msIE9-sfdev2dev
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: unicode/encoding issues

by Богун Дмитрий :: Rate this Message:

| View Threaded | Show Only this Message

В Птн, 19/11/2010 в 17:42 +0200, Богун Дмитрий пишет:

> One more issue with not ascii letters in template.
>
> $ cat test.tmpl
> #encofing utf-8
> ##attr test = u'не ascii параметр'
> #attr test = u'не ascii параметр'
> test
> $ cheetah-compile test.tmpl
> Compiling test.tmpl -> test.py
> Traceback (most recent call last):
>   File "/usr/bin/cheetah-compile-2.6", line 3, in <module>
>     _cheetah_compile()
>   File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 625, in _cheetah_compile
>     CheetahWrapper().main()
>   File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 148, in main
>     meth()
>   File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 231, in compile
>     self._compileOrFill()
>   File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 380, in _compileOrFill
>     self._compileOrFillBundle(b)
>   File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 596, in _compileOrFillBundle
>     compilerSettings=compilerSettings)
>   File "/usr/lib/python2.6/site-packages/Cheetah/Template.py", line 740, in compile
>     settings=(compilerSettings or {}))
>   File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1575, in __init__
>     source = unicode(source)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 32: ordinal not in range(128)
>
> How can I assing not ascii string in #attr directive?
>
Sorry, make mistake in #encoding directive.
If write it correctly

$ cat test.tmpl
#encoding utf-8
##attr test = u'не ascii параметр'
#attr test = u'не ascii параметр'
test
$ cheetah-compile test.tmpl
Compiling test.tmpl -> test.py
Traceback (most recent call last):
  File "/usr/bin/cheetah-compile-2.6", line 3, in <module>
    _cheetah_compile()
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 625, in _cheetah_compile
    CheetahWrapper().main()
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 148, in main
    meth()
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 231, in compile
    self._compileOrFill()
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 380, in _compileOrFill
    self._compileOrFillBundle(b)
  File "/usr/lib/python2.6/site-packages/Cheetah/CheetahWrapper.py", line 596, in _compileOrFillBundle
    compilerSettings=compilerSettings)
  File "/usr/lib/python2.6/site-packages/Cheetah/Template.py", line 744, in compile
    generatedModuleCode = compiler.getModuleCode()
  File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1879, in getModuleCode
    return self.wrapModuleDef()
  File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1933, in wrapModuleDef
    'classes': self.classDefs(),
  File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1981, in classDefs
    classDefs = [klass.classDef() for klass in self._finishedClasses()]
  File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1423, in classDef
    return self.wrapClassDef()
  File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1449, in wrapClassDef
    addAttributes()
  File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1445, in addAttributes
    self.attributes(),
  File "/usr/lib/python2.6/site-packages/Cheetah/Compiler.py", line 1478, in attributes
    for attrib in self._generatedAttribs ]
UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-10: ordinal not in range(128)

We will got same error, but in other place.


------------------------------------------------------------------------------
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/msIE9-sfdev2dev
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: unicode/encoding issues

by Arnaud Fontaine-3 :: Rate this Message:

| View Threaded | Show Only this Message

Hi,

This issue  is similar to  the one reported  on the Debian  Bug Tracking
System[0].  Carles Muñoz Gorriz submitted a patch available there[1]. As
this bug  is still  present in  2.4.4, could you  please apply  it? Many
thanks.

Regards,
Arnaud Fontaine

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584966
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=Compiler.py.diff;att=1;bug=584966

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: unicode/encoding issues

by R. Tyler Ballance :: Rate this Message:

| View Threaded | Show Only this Message


On Sat, 25 Dec 2010, Arnaud Fontaine wrote:

> Hi,
>
> This issue  is similar to  the one reported  on the Debian  Bug Tracking
> System[0].  Carles Muñoz Gorriz submitted a patch available there[1]. As
> this bug  is still  present in  2.4.4, could you  please apply  it? Many
> thanks.
>
> Regards,
> Arnaud Fontaine
>
> [0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584966
> [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=Compiler.py.diff;att=1;bug=584966
For what it's worth, I've gone ahead and applied and tested this patch (against
2.7 at least).

I've got some other Cheetah related fixes in a long backlog that require some
other environments to be set up to properly test them. I'm hoping to get to
those next.


Either way, I'll probably push out a new release this weekend.


- R. Tyler Croy
--------------------------------------
    Code: http://github.com/rtyler
 Chatter: http://identi.ca/agentdero
          http://twitter.com/agentdero


------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

attachment0 (205 bytes) Download Attachment

Re: unicode/encoding issues

by Arnaud Fontaine-3 :: Rate this Message:

| View Threaded | Show Only this Message

Hi,

    >> http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=Compiler.py.diff;att=1;bug=584966

    > For what  it's worth, I've gone ahead and  applied and tested this
    > patch (against 2.7 at least).

Thanks.    It  might   be  a   stupid   question,  but   on  which   git
repository/branch have you applied this patch? (because I cannot find it
there[0])

    > I've got  some other Cheetah related fixes in  a long backlog that
    >  require some other  environments to  be set  up to  properly test
    > them. I'm hoping to get to those next.

    > Either way, I'll probably push out a new release this weekend.

Great!

Cheers,
--
Arnaud Fontaine

[0] https://github.com/cheetahtemplate/cheetah

------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss