Changeset 3169

Show
Ignore:
Timestamp:
04/17/07 19:41:37 (18 years ago)
Author:
jerome
Message:

Finish implementation of the usernamecase directive.

Location:
pykota/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r3159 r3169  
    391391            self.UserName = self.UserName.split(separator)[-1] 
    392392             
    393         # do we want to lowercase usernames ?     
    394         if self.config.getUserNameToLower() : 
    395             self.UserName = self.UserName.lower() 
     393        # this option is deprecated, and we want to tell people     
     394        # this is the case. 
     395        dummy = self.config.getUserNameToLower() 
     396        if dummy is not None : 
     397            self.printInfo("Option 'utolower' is deprecated. Please use the 'usernamecase' option instead. Syntax is 'usernamecase: lower|upper|native' and defaults to 'native'.", "error") 
     398        # Now use the newer and more complete 'usernamecase' directive.     
     399        casechange = self.config.getUserNameCase()     
     400        if casechange != "native" : 
     401            self.UserName = getattr(self.UserName, casechange)() 
    396402             
    397403        # do we want to strip some prefix off of titles ?     
  • pykota/trunk/conf/pykota.conf.sample

    r3162 r3169  
    329329 
    330330 
    331 # Should we force usernames to be all lowercase when printing ? 
    332 # Default is No.  
     331# Should we modify usernames when printing ? 
     332# Default is native, meaning usernames won't be modified. 
    333333# This is a [global] option only. 
    334 # Some people reported that WinXP sends mixed case usernames 
    335 # setting 'utolower: Yes' solves the problem. 
    336 # Of course you have to use lowercase only when adding 
    337 # users with edpykota, because ALL database accesses are 
     334# Some people reported that WinXP sends mixed case usernames, 
     335# setting usernamecase to 'upper' or 'lower' solves the problem. 
     336# Of course you have to use uppercase or lowercase only when managing 
     337# users with pkusers, because ALL database accesses are 
    338338# still case sensitive. 
    339339# 
    340 # If utolower is Yes, the usernames received from the printing 
    341 # system is converted to lowercase at the start of printing, 
    342 # BUT ONLY when printing. 
    343 # 
    344 # If utolower is No, which is the default, strict case checking 
     340# If usernamecase is 'upper' or 'lower', the usernames received  
     341# from the printing system are converted to uppercase or lowercase,  
     342# respectively, at the start of printing, BUT ONLY when printing. 
     343# 
     344# If usernamecase is 'native', which is the default, strict case checking 
    345345# is done, this means that users 'Jerome' and 'jerome' are 
    346346# different. Printer and groups names are ALWAYS case sensitive. 
    347347# 
    348 utolower: No 
     348# usernamecase : upper 
     349# usernamecase : lower 
     350usernamecase: native 
    349351 
    350352 
  • pykota/trunk/pykota/config.py

    r3162 r3169  
    7777        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) :     
    7878            if ignore : 
    79                 return 
     79                return None 
    8080            else : 
    8181                raise PyKotaConfigError, _("Option %s not found in section global of %s") % (option, self.filename) 
     
    522522             
    523523    def getUserNameToLower(self) :           
    524         """Returns True if we want to convert usernames to lowercase when printing, else False.""" 
    525         return self.isTrue(self.getGlobalOption("utolower", ignore=1)) 
     524        """Deprecated.""" 
     525        return self.getGlobalOption("utolower", ignore=1) 
     526         
     527    def getUserNameCase(self) : 
     528        """Returns value for user name case: upper, lower or native""" 
     529        validvalues = [ "upper", "lower", "native" ] 
     530        value = self.getGlobalOption("usernamecase", ignore=1).strip().lower() 
     531        if value is None : 
     532            value = "native" 
     533        if value not in validvalues : 
     534            raise PyKotaConfigError, _("Option usernamecase only supports values in %s") % str(validvalues) 
     535        return value 
    526536         
    527537    def getRejectUnknown(self) :