Ticket #6749: python_logfile_py3.patch

File python_logfile_py3.patch, 1.4 KB (added by realcr, 2 years ago)

Minor syntax changes for python3 porting.

  • twisted/python/logfile.py

    diff --git twisted/python/logfile.py twisted/python/logfile.py
    index f652271..0f50b17 100644
     
    77A rotating, browsable log file.
    88"""
    99
     10from __future__ import print_function,division,absolute_import
    1011# System Imports
    1112import os, glob, time, stat
    1213
    class BaseLogFile: 
    6667        else:
    6768            if self.defaultMode is not None:
    6869                # Set the lowest permissions
    69                 oldUmask = os.umask(0777)
     70                oldUmask = os.umask(int("777",8))
    7071                try:
    7172                    self._file = file(self.path, "w+", 1)
    7273                finally:
    class LogFile(BaseLogFile): 
    178179        """
    179180        filename = "%s.%d" % (self.path, identifier)
    180181        if not os.path.exists(filename):
    181             raise ValueError, "no such logfile exists"
     182            raise ValueError("no such logfile exists")
    182183        return LogReader(filename)
    183184
    184185    def write(self, data):
    class DailyLogFile(BaseLogFile): 
    266267            return self.getCurrentLog()
    267268        filename = "%s.%s" % (self.path, self.suffix(identifier))
    268269        if not os.path.exists(filename):
    269             raise ValueError, "no such logfile exists"
     270            raise ValueError("no such logfile exists")
    270271        return LogReader(filename)
    271272
    272273    def write(self, data):