Loading ...
Sorry, an error occurred while loading the content.
 

[Cheetahtemplate-discuss] unicode, comments and python statements

Expand Messages
  • William Dode
    Hi, If we use the #unicode utf8 in the begin of a template it still include non ascii characters and raise the pep-0263 Do i missed somethings ? print
    Message 1 of 2 , Aug 20 2:18 AM
      Hi,

      If we use the #unicode utf8 in the begin of a template it still include
      non ascii characters and raise the pep-0263

      Do i missed somethings ?

      print Template.compile('''
      #unicode utf8

      #* à *#

      #set $a=u'é'
      ''', returnAClass=False)


      #!/usr/bin/env python




      ##################################################
      ## DEPENDENCIES
      import sys
      import os

      [...]

      ########################################
      ## START - generated method body

      # à
      write(u'''
      ''')
      a = u'é'

      ########################################
      ## END - generated method body

      --
      William Dodé - http://flibuste.net
      Informaticien Indépendant


      -------------------------------------------------------------------------
      This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
      Build the coolest Linux based applications with Moblin SDK & win great prizes
      Grand prize is a trip for two to an Open Source event anywhere in the world
      http://moblin-contest.org/redirect.php?banner_id=100&url=/
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Tavis Rudd
      William, I don t think there s any problem here as the module src it returns is a unicode string and, thus, must be encoded before it is saved to the
      Message 2 of 2 , Nov 10, 2008
        William,
        I don't think there's any problem here as the module src it returns is a
        unicode string and, thus, must be encoded before it is saved to the
        filesystem. Using your example template src as input to "Template(src)"
        or "templateClass = Template.compile(src)" doesn't raise an exception.

        If you're writing .tmpl files that have non-ascii chars, you should use
        the #encoding directive.

        Tavis


        On Wed, 20 Aug 2008, William Dode wrote:

        > Hi,
        >
        > If we use the #unicode utf8 in the begin of a template it still include
        > non ascii characters and raise the pep-0263
        >
        > Do i missed somethings ?
        >
        > print Template.compile('''
        > #unicode utf8
        >
        > #* à *#
        >
        > #set $a=u'é'
        > ''', returnAClass=False)
        >
        >
        > #!/usr/bin/env python
        >
        >
        >
        >
        > ##################################################
        > ## DEPENDENCIES
        > import sys
        > import os
        >
        > [...]
        >
        > ########################################
        > ## START - generated method body
        >
        > # à
        > write(u'''
        > ''')
        > a = u'é'
        >
        > ########################################
        > ## END - generated method body
        >
        > --
        > William Dodé - http://flibuste.net
        > Informaticien Indépendant
        >
        >
        > -------------------------------------------------------------------------
        > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
        > Build the coolest Linux based applications with Moblin SDK & win great prizes
        > Grand prize is a trip for two to an Open Source event anywhere in the world
        > http://moblin-contest.org/redirect.php?banner_id=100&url=/
        > _______________________________________________
        > Cheetahtemplate-discuss mailing list
        > Cheetahtemplate-discuss@...
        > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.