summaryrefslogtreecommitdiffstats
path: root/tabellio
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2011-11-06 10:01:19 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2011-11-06 10:01:19 (GMT)
commit8b09df1893a40fd3a6fbcadda81197f3e7432c51 (patch)
treefac1080a4730e577cbd554abfcbfacba800e2c4f /tabellio
parent3f8d8489ee2c6283c7ff6005a60e88cdb64ec4cb (diff)
downloadtabellio.pcfdb-8b09df1893a40fd3a6fbcadda81197f3e7432c51.zip
tabellio.pcfdb-8b09df1893a40fd3a6fbcadda81197f3e7432c51.tar.gz
tabellio.pcfdb-8b09df1893a40fd3a6fbcadda81197f3e7432c51.tar.bz2
add sync of sessions
Diffstat (limited to 'tabellio')
-rw-r--r--tabellio/pcfdb/sync.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/tabellio/pcfdb/sync.py b/tabellio/pcfdb/sync.py
index 81e0e18..5859ef5 100644
--- a/tabellio/pcfdb/sync.py
+++ b/tabellio/pcfdb/sync.py
@@ -267,7 +267,7 @@ class SyncFromPcfDbView(BrowserView):
self.setup()
timestamp = self.request.form.get('timestamp')
objects = self.request.form.get('objects', '').split(',')
- for object in ('polgroups', 'deputies', 'ministries', 'persons', 'commissions',
+ for object in ('polgroups', 'sessions', 'deputies', 'ministries', 'persons', 'commissions',
'documents', 'dossiers', 'questions', 'reunions', 'deptables'):
if not 'all' in objects:
if not object in objects:
@@ -300,6 +300,26 @@ class SyncFromPcfDbView(BrowserView):
cursor.close()
return addr
+ def sync_sessions(self, timestamp=None):
+ cursor = self.db_connection.cursor()
+
+ cursor.execute('''SELECT t_legisl.nom, t_sess.id
+ FROM t_sess
+ JOIN t_legisl
+ ON (t_sess.legislid = t_legisl.id)
+ ORDER BY t_sess.datedeb DESC''')
+
+ sessions = []
+ while True:
+ row = cursor.fetchone()
+ if row is None:
+ break
+ sessions.append('%s:%s' % row)
+
+ cursor.close()
+
+ self.settings.sessions = '\n'.join(sessions)
+
def sync_polgroups(self, timestamp=None):
cursor = self.db_connection.cursor()