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/repykota

    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/>. 
     
    3636from pykota.tool import PyKotaTool 
    3737from pykota import reporter 
    38          
    39 class RePyKota(PyKotaTool) :         
     38 
     39class RePyKota(PyKotaTool) : 
    4040    """A class for repykota.""" 
    4141    def main(self, ugnames, options) : 
     
    4343        if options.ingroups and options.groups : 
    4444            raise PyKotaCommandLineError, _("Incompatible options, see help.") 
    45              
     45 
    4646        if self.config.isAdmin : 
    4747            # PyKota administrator 
     
    4949                # no username, means all usernames 
    5050                ugnames = [ "*" ] 
    51                  
     51 
    5252            if options.ingroups : 
    5353                groupsnames = options.ingroups.split(",") 
     
    5757                    if not group.Exists : 
    5858                        self.printInfo("Group %s doesn't exist." % group.Name, "warn") 
    59                     else :     
     59                    else : 
    6060                        for user in self.storage.getGroupMembers(group) : 
    6161                            members[user.Name] = user 
    6262                ugnames = [ m for m in members.keys() if self.matchString(m, ugnames) ] 
    63         else :         
     63        else : 
    6464            # reports only the current user 
    6565            if options.ingroups : 
    6666                raise PyKotaCommandLineError, _("Option --ingroups is reserved to PyKota Administrators.") 
    67                  
     67 
    6868            username = pwd.getpwuid(os.geteuid())[0] 
    6969            if options.groups : 
     
    7171                if user.Exists : 
    7272                    ugnames = [ g.Name for g in self.storage.getUserGroups(user) ] 
    73                 else :     
     73                else : 
    7474                    ugnames = [ ] 
    7575            else : 
    7676                ugnames = [ username ] 
    77          
     77 
    7878        printers = self.storage.getMatchingPrinters(options.printer) 
    7979        if not printers : 
    8080            raise PyKotaCommandLineError, _("There's no printer matching %s") % options.printer 
    81              
     81 
    8282        self.reportingtool = reporter.openReporter(self, "text", printers, ugnames, options.groups) 
    8383        print self.reportingtool.generateReport() 
    84                      
    85 if __name__ == "__main__" :  
     84 
     85if __name__ == "__main__" : 
    8686    parser = PyKotaOptionParser(description=_("Minimalist print accounting reports for PyKota. If not launched by a PyKota administrator, additionnal arguments representing users or groups names are ignored, limiting the scope of the reports to the current user."), 
    8787                                usage="repykota [options] [usernames|groupnames]") 
     
    9797                            default="*", 
    9898                            help=_("Acts on this printer only. You can specify several printer names by separating them with commas. The default value is '%default', which means all printers.")) 
    99                              
     99 
    100100    parser.add_example('', 
    101101                       _("This would generate a report for all users on all printers.")) 
     
    104104    parser.add_example('--printer "laser*,*pson" jerome "jo*"', 
    105105                       _("This would generate a report for all users named 'jerome' or whose name begins with 'jo', on all printers which name begins with 'laser' or ends with 'pson'.")) 
    106                         
     106 
    107107    run(parser, RePyKota)