Show
Ignore:
Timestamp:
09/27/08 22:02:37 (16 years ago)
Author:
jerome
Message:

Removed unnecessary spaces at EOL.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/autopykota

    r3411 r3413  
    99# the Free Software Foundation, either version 3 of the License, or 
    1010# (at your option) any later version. 
    11 #  
     11# 
    1212# This program is distributed in the hope that it will be useful, 
    1313# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1414# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1515# GNU General Public License for more details. 
    16 #  
     16# 
    1717# You should have received a copy of the GNU General Public License 
    1818# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    6161                if printer.Exists : 
    6262                    self.logdebug("Printer %s created successfully." % printername) 
    63                 else :     
     63                else : 
    6464                    self.logdebug("Impossible to create printer %s." % printername) 
    6565                printernames = [printername] 
    66             else :     
     66            else : 
    6767                printernames = [printer.Name] + [p.Name for p in self.storage.getParentPrinters(printer)] 
    68              
     68 
    6969            user = self.storage.getUser(username) 
    7070            if not user.Exists : 
     
    7272                if (options.email is None) : 
    7373                    os.system('pkusers --add --limitby balance --balance "%s" --description "%s" "%s"' \ 
    74                                        % (options.initbalance,  
     74                                       % (options.initbalance, 
    7575                                          _("user created with autopykota").encode(self.charset, "replace"), 
    7676                                          username.encode(self.charset))) 
    7777                else : 
    7878                    os.system('pkusers --add --limitby balance --balance "%s" --email "%s" --description "%s" "%s"' \ 
    79                                        % (options.initbalance,  
    80                                           options.email.encode(self.charset),  
     79                                       % (options.initbalance, 
     80                                          options.email.encode(self.charset), 
    8181                                          _("user created with autopykota").encode(self.charset, "replace"), 
    8282                                          username.encode(self.charset))) 
    83                      
     83 
    8484                user = self.storage.getUserFromBackend(username) 
    8585                if user.Exists : 
    8686                    self.logdebug("User %s created successfully." % username) 
    87                 else :     
     87                else : 
    8888                    self.logdebug("Impossible to create user %s." % username) 
    89                  
    90             if user.Exists and printer.Exists :     
     89 
     90            if user.Exists and printer.Exists : 
    9191                userpquota = self.storage.getUserPQuota(user, printer) 
    9292                if not userpquota.Exists : 
     
    9494                                        % (username, printernames)) 
    9595                    os.system('edpykota --add --printer "%s" "%s"' \ 
    96                                 % (','.join(printernames).encode(self.charset),  
     96                                % (','.join(printernames).encode(self.charset), 
    9797                                   username.encode(self.charset))) 
    98                     userpquota = self.storage.getUserPQuotaFromBackend(user,  
     98                    userpquota = self.storage.getUserPQuotaFromBackend(user, 
    9999                                                                       printer) 
    100100                    if userpquota.Exists : 
     
    102102                                            % (username, printername)) 
    103103                        return 0 
    104                     else :     
     104                    else : 
    105105                        self.logdebug("Impossible to create user %s's print quota entry on printer %s." \ 
    106106                                            % (username, printername)) 
     
    110110                                        % (username, printername)) 
    111111                    return 0 
    112             else :         
     112            else : 
    113113                return -1 
    114                  
    115 if __name__ == "__main__" :     
     114 
     115if __name__ == "__main__" : 
    116116    parser = PyKotaOptionParser(description=_("A tool to automate user account creation and initial balance setting. THIS TOOL MUST NOT BE USED FROM THE COMMAND LINE BUT ONLY AS PART OF AN external policy IN pykota.conf, AND MUST NOT BE USED IF YOU WANT TO LIMIT YOUR USERS BY PAGE QUOTA !"), 
    117117                                usage="autopykota { -i | --initbalance value } [options]") 
     
    124124                            dest="email", 
    125125                            help=_("Set the user's email address.")) 
    126                              
     126 
    127127    parser.add_example('--email="@example.com" --initbalance=10.0', 
    128128                       _("This would set the current user's email address to $PYKOTAUSERNAME@example.com, and would set the initial value of his account balance to 10.0 credits.")) 
    129                         
     129 
    130130    run(parser, AutoPyKota)