From a5866fc8b832a0f59d0df05b464fc232441828b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 21 Nov 2011 13:57:09 +0100 Subject: [PATCH] add decrets panel (#944) --- tabellio/searchform/docsearch.pt | 34 ++++++++++++++++++++++++++++++++ tabellio/searchform/form.py | 24 ++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/tabellio/searchform/docsearch.pt b/tabellio/searchform/docsearch.pt index 17f4ccb..b684e8d 100644 --- a/tabellio/searchform/docsearch.pt +++ b/tabellio/searchform/docsearch.pt @@ -128,6 +128,40 @@
Décrets
+ +

Année de sanction et de promulgation

+ + + + + + + + + + + + + + + + + + + + + + + + + +
DocumentIntituléDate
AdoptionSanctionMoniteur
title
+
diff --git a/tabellio/searchform/form.py b/tabellio/searchform/form.py index 29b7066..dba6855 100644 --- a/tabellio/searchform/form.py +++ b/tabellio/searchform/form.py @@ -2,6 +2,7 @@ import re import time +import datetime from five import grok from plone.memoize import instance, ram @@ -790,6 +791,29 @@ class SearchView(BrowserView): def eventform_url(self): return self.portal_url() + '/eventsearch' + def decrets_years(self): + now = time.localtime() + return range(1973, now[0]+1) + + def decrets_year(self): + now = time.localtime() + year = int(self.request.form.get('year') or now[0]) + return year + + def decrets(self): + now = time.localtime() + year = int(self.request.form.get('year') or now[0]) + + start = datetime.datetime(year, 1, 1) + end = datetime.datetime(year+1, 1, 1) + + catalog = getToolByName(self.context, 'portal_catalog') + rs = catalog(portal_type='tabellio.documents.document', + doctype='DECCCF', + dateDoc={'query': (start, end), 'range': 'min:max'}, + sort_on='dateDoc') + return rs + class Reflex(BrowserView): def __call__(self):