Beispiel #1
0
# License, or (at your option) any later version.
#
# CKANExt-Etalab is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from biryani import baseconv, custom_conv, states
from ckan import plugins
import ckan.plugins.toolkit as tk


conv = custom_conv(baseconv, states)


class PiwikPlugin(plugins.SingletonPlugin):
    site_id = None
    url = None
    domain = None
    error = None
    cookies_disabled = None

    plugins.implements(plugins.IConfigurable)
    plugins.implements(plugins.ITemplateHelpers)

    def configure(self, config):
        config.update(conv.check(conv.struct({
            'piwik.site_id': conv.input_to_int,
Beispiel #2
0
import argparse
import collections
import datetime
import logging
import os
import re
import sys

from biryani import baseconv, custom_conv, datetimeconv, states
from biryani import strings
import numpy as np
import pandas as pd
import xlrd

app_name = os.path.splitext(os.path.basename(__file__))[0]
conv = custom_conv(baseconv, datetimeconv, states)
french_date_re = re.compile(ur'(?P<day>0?[1-9]|[12]\d|3[01])/(?P<month>0?[1-9]|1[0-2])/(?P<year>[12]\d{3})$')
log = logging.getLogger(app_name)
N_ = lambda message: message
parameters = []
year_re = re.compile(ur'[12]\d{3}$')


def input_to_french_date(value, state = None):
    if value is None:
        return None, None
    if state is None:
        state = conv.default_state
    match = french_date_re.match(value)
    if match is None:
        return value, state._(u'Invalid french date')
# License, or (at your option) any later version.
#
# CKANExt-Etalab is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from biryani import baseconv, custom_conv, states
from ckan import plugins
import ckan.plugins.toolkit as tk


conv = custom_conv(baseconv, states)


class PiwikPlugin(plugins.SingletonPlugin):
    site_id = None
    url = None
    domain = None
    error = None
    cookies_disabled = None
    googleanalytics_id = None

    plugins.implements(plugins.IConfigurable)
    plugins.implements(plugins.ITemplateHelpers)

    def configure(self, config):
        config.update(conv.check(conv.struct({