Author: afages Date: 2010-03-09 11:24:57 +0100 (Tue, 09 Mar 2010) New Revision: 198 Log: Modification planning + ajout rapport Added: trunk/src/site/doc/rapport/ trunk/src/site/doc/rapport/rapport.rst trunk/src/site/doc/rapport/rst2pdf-net.py trunk/src/site/doc/soutenance/ Modified: trunk/src/site/reports/CompteRendu_02-03-2010.rst trunk/src/site/reports/planningMSM.xls Added: trunk/src/site/doc/rapport/rapport.rst =================================================================== --- trunk/src/site/doc/rapport/rapport.rst (rev 0) +++ trunk/src/site/doc/rapport/rapport.rst 2010-03-09 10:24:57 UTC (rev 198) @@ -0,0 +1,16 @@ +Rapport du projet de fin d'étude : Map Storage Manager +====================================================== + +:Authors: + Gilles CRIELOUE., + Dorian LANGLAIS., + Florent GILET., + Amaury FAGES., + +:Version: 1.0 of 9/03/10 +:Dedication: To Code Lutin & Université de Nantes + +Spécification préliminaire +========================== + + Added: trunk/src/site/doc/rapport/rst2pdf-net.py =================================================================== --- trunk/src/site/doc/rapport/rst2pdf-net.py (rev 0) +++ trunk/src/site/doc/rapport/rst2pdf-net.py 2010-03-09 10:24:57 UTC (rev 198) @@ -0,0 +1,147 @@ +#!/usr/bin/env python +import os +import sys +import time +import urllib2 +from urllib2 import HTTPError +from urllib import urlencode +from optparse import OptionParser + +CLIENT_VERSION = '1.0' +API_VERSION = '1' + +API_BASE_URL = '%s://%s' +API_POST = '%s/post' +API_DOWNLOAD = '%s/download' +API_SCRIPT_VERSION = '%s/script_version' + +DEFAULT_PROTCOL = 'http' +DEFAULT_DOMAIN = 'www.rst2pdf.net' +DEFAULT_ENCODING = 'utf-8' +DEFAULT_RETRY_NUM = 5 +DEFAULT_SECURE_PROTCOL = 'https' +DEFAULT_SECURE_DOMAIN = 'rst2pdf-net.appspot.com' + +def get_opener(): + opener = urllib2.build_opener() + opener.addheaders = [('User-agent', 'rst2pdf-net/%s' % CLIENT_VERSION)] + return opener + +def url_get(url, retry=DEFAULT_RETRY_NUM, output_status=True, output=sys.stdout): + opener = get_opener() + for x in range(retry): + if output_status: + output.write('.') + try: + time.sleep(x * 2) + response = opener.open(url) + return response.read() + except HTTPError: + pass + return None + +def rst_net_post(body, domain=DEFAULT_DOMAIN, protocol=DEFAULT_PROTCOL, password=None): + url_base = API_BASE_URL % (protocol, domain) + url_post = API_POST % url_base + opener = get_opener() + params = {'body': body, 'format': 'text', 'version': API_VERSION} + if password: + params['password'] = password + response = opener.open(url_post, urlencode(params)) + return response.read() + +def parse_text_response(response): + response_dict = {} + for line in response.splitlines(): + if line and '=' in line: + key, value = line.split('=', 1) + response_dict[key] = value + return response_dict + +def main(): + usage = "Usage: %prog [options] [filename]" + parser = OptionParser(usage=usage) + parser.add_option('-d', '--domain', + dest='domain', + help='use other domain, default domain is "%s", if secure mode is "%s"' \ + % (DEFAULT_DOMAIN, DEFAULT_SECURE_DOMAIN), + default=DEFAULT_DOMAIN) + parser.add_option('-c', '--protocol', + dest='protocol', + help='use other protocol, default protocol is "%s", if secure mode is "%s"' \ + % (DEFAULT_PROTCOL, DEFAULT_SECURE_PROTCOL)) + parser.add_option('-e', '--encoding', + dest='encoding', + help='use other input encoding, default encoding is "%s"' % DEFAULT_ENCODING) + parser.add_option('-o', '--output', + dest='output', + help='output file path') + parser.add_option('-s', '--secure', + action='store_true', + dest='secure', + help='use secure mode') + parser.add_option('-p', '--password', + dest='password', + help='use password(force secure mode)') + options, args = parser.parse_args() + + if not args: + stream = sys.stdin + input_file = '' + else: + stream = open(args[0], 'rb') + input_file = args[0] + source = stream.read() + if options.encoding: + source = source.decode(options.encoding).encode(DEFAULT_ENCODING) + secure = options.secure + if options.password: + secure = True + domain = options.domain + protocol = options.protocol + if secure: + if domain == DEFAULT_DOMAIN: + domain = DEFAULT_SECURE_DOMAIN + if not protocol: + protocol = DEFAULT_SECURE_PROTCOL + protocol = protocol or DEFAULT_PROTCOL + + sys.stdout.write('Sending rst...\n') + + response = parse_text_response(rst_net_post(source, domain, protocol, options.password)) + + if not 'hash' in response: + sys.stderr.write("Error: Response don't have hash key.\n") + return + + sys.stdout.write('Document hash: %s\n' % response['hash']) + + if options.password: + sys.stdout.write('Pdf was created, download url is "%s".\n' % response['url']) + else: + url_download = API_DOWNLOAD % response['url'][:-1] + + sys.stdout.write('Downloading pdf from "%s"\n' % url_download) + + pdf_body = url_get(url_download) + sys.stdout.write('\n') + if not pdf_body: + sys.stderr.write('Error: Download faled "%s".\n' % url_download) + return + + if options.output: + output_file = options.output + elif input_file: + base, ext = os.path.splitext(input_file) + output_file = '%s.pdf' % base + else: + output_file = '%s.pdf' % response['hash'] + sys.stdout.write('Writing pdf file "%s"...\n' % output_file) + f = open(output_file, 'wb') + f.write(pdf_body) + f.close() + + sys.stdout.write('Completed.\n') + +if __name__ == '__main__': + main() Modified: trunk/src/site/reports/CompteRendu_02-03-2010.rst =================================================================== --- trunk/src/site/reports/CompteRendu_02-03-2010.rst 2010-03-08 20:36:48 UTC (rev 197) +++ trunk/src/site/reports/CompteRendu_02-03-2010.rst 2010-03-09 10:24:57 UTC (rev 198) @@ -39,8 +39,8 @@ RAF (Reste à faire) ------------------- --H/J sur le planning. (Amaury) --Estimation avec JTimer sur le temps passé sur les taches. (Amaury) +-H/J sur le planning. (Amaury) DONE +-Estimation avec JTimer sur le temps passé sur les taches. (Amaury) ~DONE -Rendre plus générique le loader de plugin (BigTableLoader -> PluginLoader). (Gilles) -Le plugin (exemple : import/export) doit pouvoir rajouter des entrées dans le menu. (Dorian) -Adapter l'affichage de la table à la largeur de la fenêtre. (Florent) Modified: trunk/src/site/reports/planningMSM.xls =================================================================== (Binary files differ)
participants (1)
-
afages@users.nuiton.org