Changeset 2973

Show
Ignore:
Timestamp:
07/11/06 20:40:50 (18 years ago)
Author:
jerome
Message:

In case there's a permission problem on the temporary directory, falls
back to /tmp or /var/tmp

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r2961 r2973  
    239239         
    240240        self.PrinterName = os.environ.get("PRINTER", "") 
    241         self.Directory = self.config.getPrinterDirectory(self.PrinterName) 
     241        directories = [ self.config.getPrinterDirectory(self.PrinterName), 
     242                        "/tmp", 
     243                        "/var/tmp" ] 
     244        self.Directory = None 
     245        for direc in directories : 
     246            if os.access(direc, os.O_RDWR) : 
     247                self.Directory = direc 
     248                break 
     249            else : 
     250                self.printInfo("Insufficient permissions to access to temporary directory %s" % direc, "warn") 
     251                 
    242252        self.Action = "ALLOW"   # job allowed by default 
    243253        self.Reason = None