- Timestamp:
- 05/03/08 18:58:06 (17 years ago)
- Location:
- pykota/trunk
- Files:
-
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkbcodes
r3362 r3367 46 46 def main(self, names, options) : 47 47 """Manage billing codes.""" 48 if (not self.config.isAdmin) and (options.action != "list"):49 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))48 if options.action != "list" : 49 self.adminOnly() 50 50 51 51 islist = (options.action == "list") -
pykota/trunk/bin/pkinvoice
r3365 r3367 189 189 raise PyKotaToolError, "The Python Imaging Library is missing. Download it from http://www.pythonware.com/downloads" 190 190 191 if not self.config.isAdmin : 192 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command.")) 191 self.adminOnly() 193 192 194 193 self.pagesize = getPageSize(options.pagesize) -
pykota/trunk/bin/pkprinters
r3295 r3367 190 190 def main(self, names, options) : 191 191 """Manage printers.""" 192 if (not self.config.isAdmin) and (not options["list"]):193 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))192 if not options["list"] : 193 self.adminOnly() 194 194 195 195 docups = options["cups"] -
pykota/trunk/bin/pkrefund
r3360 r3367 183 183 raise PyKotaToolError, "The Python Imaging Library is missing. Download it from http://www.pythonware.com/downloads" 184 184 185 if not self.config.isAdmin : 186 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command.")) 185 self.adminOnly() 187 186 188 187 self.pagesize = getPageSize(options.pagesize) -
pykota/trunk/bin/pkturnkey
r3295 r3367 381 381 def main(self, names, options) : 382 382 """Intializes PyKota's database.""" 383 if not self.config.isAdmin : 384 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], \ 385 _("You're not allowed to use this command.")) 386 383 self.adminOnly() 384 387 385 if not names : 388 386 names = ["*"] -
pykota/trunk/pykota/tool.py
r3327 r3367 171 171 sys.stderr.flush() 172 172 173 def adminOnly(self, restricted=True) : 174 """Raises an exception if the user is not a PyKota administrator.""" 175 if restricted and not self.config.isAdmin : 176 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command.")) 177 173 178 def matchString(self, s, patterns) : 174 179 """Returns True if the string s matches one of the patterns, else False.""" -
pykota/trunk/pykota/utils.py
r3366 r3367 31 31 from pykota.errors import PyKotaCommandLineError 32 32 33 def onlyAdmin(app, restricted=True) :34 """Raises an exception if the user is not a PyKota administrator."""35 if restricted and not app.config.isAdmin :36 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command."))37 38 33 def initlocale(lang="", cset=None) : 39 34 """Initializes the locale stuff."""