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

[Cheetahtemplate-discuss] 'type(file)==StringType' misses unicode filenames

Expand Messages
  • Terrel Shumway
    in Cheetah/Template.py, near line 229 ... self._fileMtime = None self._fileDirName = None self._fileBaseName = None if file and type(file) == StringType: file
    Message 1 of 2 , Jan 14, 2004
      in Cheetah/Template.py, near line 229
      ---
      self._fileMtime = None
      self._fileDirName = None
      self._fileBaseName = None
      if file and type(file) == StringType:
      file = self.serverSidePath(file)
      self._fileMtime = os.path.getmtime(file)
      self._fileDirName, self._fileBaseName = os.path.split(file)
      self._filePath = file

      ---

      the use of "type(file)==StringType" causes a failure if file is a
      unicode string. I see that this is used in about 10 places.

      this should be "type(file) in types.StringTypes", but StringTypes was
      introduced in python 2.2 (I don't know how far back anyone cares to use
      cheetah) Maybe something like this would work:

      try:
      from types import StringTypes
      except ImportError:
      StringTypes = (types.StringType,types.UnicodeType)

      def isString(data):
      type(data) in StringTypes




      -------------------------------------------------------
      This SF.net email is sponsored by: Perforce Software.
      Perforce is the Fast Software Configuration Management System offering
      advanced branching capabilities and atomic changes on 50+ platforms.
      Free Eval! http://www.perforce.com/perforce/loadprog.html
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Tavis Rudd
      I ve just checked in some changes to handle this. Thanks for pointing it out. ... This SF.net email is sponsored by: Perforce Software. Perforce is the Fast
      Message 2 of 2 , Jan 14, 2004
        I've just checked in some changes to handle this. Thanks for pointing it out.

        On Wednesday 14 January 2004 03:52, Terrel Shumway wrote:
        > in Cheetah/Template.py, near line 229
        > ---
        > self._fileMtime = None
        > self._fileDirName = None
        > self._fileBaseName = None
        > if file and type(file) == StringType:
        > file = self.serverSidePath(file)
        > self._fileMtime = os.path.getmtime(file)
        > self._fileDirName, self._fileBaseName = os.path.split(file)
        > self._filePath = file
        >
        > ---
        >
        > the use of "type(file)==StringType" causes a failure if file is a
        > unicode string. I see that this is used in about 10 places.
        >
        > this should be "type(file) in types.StringTypes", but StringTypes was
        > introduced in python 2.2 (I don't know how far back anyone cares to use
        > cheetah) Maybe something like this would work:
        >
        > try:
        > from types import StringTypes
        > except ImportError:
        > StringTypes = (types.StringType,types.UnicodeType)
        >
        > def isString(data):
        > type(data) in StringTypes
        >
        >
        >
        >
        > -------------------------------------------------------
        > This SF.net email is sponsored by: Perforce Software.
        > Perforce is the Fast Software Configuration Management System offering
        > advanced branching capabilities and atomic changes on 50+ platforms.
        > Free Eval! http://www.perforce.com/perforce/loadprog.html
        > _______________________________________________
        > Cheetahtemplate-discuss mailing list
        > Cheetahtemplate-discuss@...
        > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss



        -------------------------------------------------------
        This SF.net email is sponsored by: Perforce Software.
        Perforce is the Fast Software Configuration Management System offering
        advanced branching capabilities and atomic changes on 50+ platforms.
        Free Eval! http://www.perforce.com/perforce/loadprog.html
        _______________________________________________
        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.