list2form : gestion des erreurs et des petits fichiers (merci cgi.py…)
[progfou.git] / wcs / wcs-status
CommitLineData
0f48356a
P
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4import os
5import sys
6
7if len(sys.argv) != 3:
8 print >>sys.stderr, "Usage : %s <site> <formulaire>" % sys.argv[0]
9 sys.exit(1)
10VHOST = sys.argv[1]
11FORM_NAME = sys.argv[2]
12
13PRINT_FORMAT = "%4s | %-17s | %-52s"
14PRINT_HEADERS = PRINT_FORMAT % ('Num.', 'Statut', 'Utilisateur')
15PRINT_BAR = "=" * len(PRINT_HEADERS)
16
17from wcs import publisher
18from wcs.formdef import FormDef
19
20pub = publisher.WcsPublisher.create_publisher()
21pub.app_dir = os.path.join(pub.app_dir, VHOST)
22
23formdef = FormDef.get_by_urlname(FORM_NAME)
24
25print PRINT_HEADERS
26print PRINT_BAR
27
28for object in formdef.data_class().select():
29 print PRINT_FORMAT % ('%04d' % object.id,
30 object.get_workflow_status().name,
31 '%s <%s>' % (object.user.display_name, object.user.email),
32 )
33
34print PRINT_BAR