Changeset 43 for pkipplib/trunk

Show
Ignore:
Timestamp:
11/27/07 09:20:45 (16 years ago)
Author:
jerome
Message:

Now uses authentication information inherited from CUPS, if needed.
Deactivated the socket:// scheme, until a fix is found.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkipplib/trunk/pkipplib/pkipplib.py

    r42 r43  
    591591        else :         
    592592            self.url = self.getDefaultURL() 
    593         self.username = username 
    594         self.password = password 
     593             
     594        # If no username or password, use the ones set by CUPS, if any 
     595        self.username = username or os.environ.get("AUTH_USERNAME") 
     596        self.password = password or os.environ.get("AUTH_PASSWORD") 
     597         
    595598        self.charset = charset 
    596599        self.language = language 
     
    603606        """Builds a default URL.""" 
    604607        # TODO : encryption methods. 
    605         server = os.environ.get("CUPS_SERVER") or "localhost" 
    606         port = os.environ.get("IPP_PORT") or 631 
     608        server = os.environ.get("CUPS_SERVER", "localhost") 
     609        port = os.environ.get("IPP_PORT", "631") 
    607610        if server.startswith("/") : 
    608611            # it seems it's a unix domain socket. 
    609612            # we can't handle this right now, so we use the default instead. 
    610             # return "http://localhost:%s" % port 
    611             return "socket:%s" % server 
     613            return "http://localhost:%s" % port 
     614            #return "socket:%s" % server # TODO : make this work ! 
    612615        else :     
    613616            return "http://%s:%s" % (server, port)