Changeset 1542
- Timestamp:
- 06/17/04 15:26:51 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r1541 r1542 24 24 # 25 25 # $Log$ 26 # Revision 1.63 2004/06/17 13:26:50 jalet 27 # Better exception handling code 28 # 26 29 # Revision 1.62 2004/06/16 20:56:34 jalet 27 30 # Smarter initialisation code … … 642 645 return retcode 643 646 647 def crashed(message) : 648 """Minimal crash method.""" 649 import traceback 650 lines = [] 651 for line in traceback.format_exception(*sys.exc_info()) : 652 lines.extend([l for l in line.split("\n") if l]) 653 msg = "ERROR: ".join(["%s\n" % l for l in ([message] + lines)]) 654 sys.stderr.write(msg) 655 sys.stderr.flush() 656 644 657 if __name__ == "__main__" : 645 658 # This is a CUPS backend, we should act and die like a CUPS backend 659 retcode = 0 646 660 if len(sys.argv) == 1 : 647 661 # we will execute each existing backend in device enumeration mode … … 680 694 fullname = fullname[1:-1] 681 695 print '%s cupspykota:%s "PyKota+%s" "PyKota managed %s"' % (devicetype, device, name, fullname) 682 retcode = 0 696 retcode = 0 683 697 elif len(sys.argv) not in (6, 7) : 684 698 sys.stderr.write("ERROR: %s job-id user title copies options [file]\n" % sys.argv[0]) … … 686 700 else : 687 701 try : 688 # Initializes the backend 689 kotabackend = PyKotaBackend() 690 retcode = kotabackend.mainWork() 702 try : 703 # Initializes the backend 704 kotabackend = PyKotaBackend() 705 except SystemExit : 706 retcode = -1 707 except : 708 crashed("cupspykota backend initialization failed") 709 retcode = 1 710 else : 711 retcode = kotabackend.mainWork() 712 kotabackend.storage.close() 713 kotabackend.closeJobDataStream() 691 714 except : 692 715 try : 693 716 kotabackend.crashed("cupspykota backend failed") 694 717 except : 695 pass 696 retcode = 1 697 698 try : 699 kotabackend.storage.close() 700 except (TypeError, NameError, AttributeError) : 701 pass 702 703 try : 704 kotabackend.closeJobDataStream() 705 except NameError, msg : 706 sys.stderr.write("ERROR: PyKota's CUPS backend wrapper didn't initialize correctly : %s\n" % msg) 707 sys.stderr.flush() 708 retcode = 1 718 crashed("cupspykota backend failed") 719 retcode = 1 709 720 710 721 sys.exit(retcode) -
pykota/trunk/NEWS
r1541 r1542 22 22 PyKota NEWS : 23 23 24 - 1.19alpha22 : 25 26 - Even better debugging code. 27 24 28 - 1.19alpha21 : 25 29 26 - Additionnal check 30 - Additionnal check. 27 31 28 32 - 1.19alpha20 : -
pykota/trunk/pykota/tool.py
r1541 r1542 22 22 # 23 23 # $Log$ 24 # Revision 1.102 2004/06/17 13:26:51 jalet 25 # Better exception handling code 26 # 24 27 # Revision 1.101 2004/06/16 20:56:34 jalet 25 28 # Smarter initialisation code … … 424 427 sys.stderr.flush() 425 428 sys.exit(-1) 429 426 430 try : 427 431 self.debug = self.config.getDebug() … … 466 470 for line in traceback.format_exception(*sys.exc_info()) : 467 471 lines.extend([l for l in line.split("\n") if l]) 468 msg = "ERROR 472 msg = "ERROR: ".join(["%s\n" % l for l in ([message] + lines)]) 469 473 sys.stderr.write(msg) 470 474 sys.stderr.flush() -
pykota/trunk/pykota/version.py
r1541 r1542 22 22 # 23 23 24 __version__ = "1.19alpha2 1_unofficial"24 __version__ = "1.19alpha22_unofficial" 25 25 26 26 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""