[canon_wrapper] un peu de doc

This commit is contained in:
Daniel STAN 2013-04-13 20:04:08 +02:00
parent adebfe1ea0
commit c03e0187b3
4 changed files with 33 additions and 4 deletions

View file

@ -0,0 +1,5 @@
canon_wrapper
=============
.. automodule:: impression.canon_wrapper
:members:

View file

@ -0,0 +1,11 @@
Impression
===========
Table des matières :
.. toctree::
:maxdepth: 2
:glob:
*

View file

@ -12,6 +12,7 @@ Table des matières :
:maxdepth: 5 :maxdepth: 5
gestion/index gestion/index
impression/index
Indices and tables Indices and tables
================== ==================

View file

@ -1,9 +1,13 @@
#!/usr/bin/python #!/usr/bin/python
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
#canon_wrapper.py #canon_wrapper.py
# Authors: Daniel STAN <dstan@crans.org> """
# Antoine Durand-Gasselin <adg@crans.org> .. codeauthor:: Daniel STAN <dstan@crans.org>
# License: GPLv3 .. codeauthor:: Antoine Durand-Gasselin <adg@crans.org>
License: GPLv3
"""
import requests #pip install requests import requests #pip install requests
# See: # See:
@ -106,6 +110,7 @@ def build_url(name):
def range_checker(a, b): def range_checker(a, b):
"""Type function for a given range"""
def cast(x): def cast(x):
try: try:
v = int(x) v = int(x)
@ -117,6 +122,7 @@ def range_checker(a, b):
return cast return cast
def build_parser(): def build_parser():
"""Make argparse object"""
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="HTTP printing driver for irc3580, with compatibility mode.", description="HTTP printing driver for irc3580, with compatibility mode.",
epilog="logs are sent to syslog (eg /var/log/canon_wrapper.log)", epilog="logs are sent to syslog (eg /var/log/canon_wrapper.log)",
@ -159,6 +165,7 @@ def build_parser():
return parser return parser
def do_print(args): def do_print(args):
"""Effectively compatibilize then print the file"""
opt=build_options(args) opt=build_options(args)
syslog('Options: %s' % repr(opt)) syslog('Options: %s' % repr(opt))
#syslog('Starting ghostscript compat, piped mode') #syslog('Starting ghostscript compat, piped mode')
@ -205,3 +212,8 @@ if __name__ == '__main__':
syslog('Caught exception %s' % repr(e)) syslog('Caught exception %s' % repr(e))
raise raise
else:
parser = build_parser()
__doc__ += 'Help message::\n' +\
'\n'.join(' ' + l for l in parser.format_help().split('\n'))