summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2011-11-23 13:36:44 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2011-11-23 13:36:44 (GMT)
commit94ba9733d1a732eff9b157607edea46dc7932513 (patch)
tree809447ce55ebd37c3201b0df5341e51027eb2311
parent527ed6a3b7a619c35b52074dd976d5fdbdc74b48 (diff)
downloadtabellio.pcfdb-94ba9733d1a732eff9b157607edea46dc7932513.zip
tabellio.pcfdb-94ba9733d1a732eff9b157607edea46dc7932513.tar.gz
tabellio.pcfdb-94ba9733d1a732eff9b157607edea46dc7932513.tar.bz2
sync commission secretariat
-rw-r--r--tabellio/pcfdb/sync.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tabellio/pcfdb/sync.py b/tabellio/pcfdb/sync.py
index 2b0d06c..77c66c5 100644
--- a/tabellio/pcfdb/sync.py
+++ b/tabellio/pcfdb/sync.py
@@ -20,6 +20,7 @@ from zope import component
from zope.app.intid.interfaces import IIntIds
from z3c.relationfield import RelationValue
from zope.i18n.locales import locales
+from plone.app.textfield.value import RichTextValue
import transaction
@@ -698,6 +699,34 @@ class SyncFromPcfDbView(BrowserView):
firstname, lastname, 'S_MINISTRE')))
minist_cursor.close()
+ secr_cursor = self.db_connection.cursor()
+ secr_cursor.execute('''SELECT titre, sexe, nom, prenom, adjoint, email, attrib
+ FROM t_comsecr
+ WHERE comid = %(id)s
+ ORDER BY adjoint, nom''', {'id': com_id})
+ s = ['<ul>\n']
+ while True:
+ row = secr_cursor.fetchone()
+ if row is None:
+ break
+ titre, sexe, nom, prenom, adjoint, email, attrib = row
+ s.append('<li><a href="mailto:%s">%s %s %s</a>' % (
+ email.replace('@', ' arobase ').replace('.', ' point '),
+ titre, prenom, nom))
+ if adjoint:
+ if sexe == 'M':
+ s.append(u' (adjoint)')
+ else:
+ s.append(u' (adjointe)')
+ if attrib:
+ s.append(u' (%s)' % attrib)
+ s.append('</li>\n')
+ s.append('</ul>\n')
+ object.secretariat = RichTextValue(raw=''.join(s),
+ mimeType='text/html',
+ outputMimeType='text/x-html-safe')
+ secr_cursor.close()
+
notify(ObjectModifiedEvent(object))
if object.active:
self.publish(object)