Beispiel #1
0
    def __before__(self, action, **params):
        c.__timer = time.time()
        app_globals.app_globals._check_uptodate()

        identify_user()

        i18n.handle_request(request, c)
Beispiel #2
0
    def __before__(self, action, **params):
        c.__timer = time.time()
        app_globals.app_globals._check_uptodate()

        identify_user()

        i18n.handle_request(request, c)
Beispiel #3
0
    def __before__(self, action, **params):
        c.__timer = time.time()
        app_globals.app_globals._check_uptodate()

        self._identify_user()

        i18n.handle_request(request, c)

        maintain.deprecate_context_item("new_activities", "Use `h.new_activities` instead.")
Beispiel #4
0
    def __before__(self, action, **params):
        c.__timer = time.time()
        app_globals.app_globals._check_uptodate()

        self._identify_user()

        i18n.handle_request(request, c)

        maintain.deprecate_context_item('new_activities',
                                        'Use `h.new_activities` instead.')
def excel_data_dictionary(geno):
    """
    return an openpyxl.Workbook object containing the field reference
    from geno, one sheet per language
    """
    book = openpyxl.Workbook()
    sheet = book.active

    style1 = {
        'PatternFill': {
            'patternType': 'solid',
            'fgColor': 'FFFFF056'},
        'Font': {
            'bold': True}}
    style2 = {
        'PatternFill': {
            'patternType': 'solid',
            'fgColor': 'FFDFE2DB'}}

    from pylons import config
    from ckan.lib.i18n import handle_request, get_lang
    from ckan.common import c, request

    for lang in config['ckan.locales_offered'].split():
        if sheet is None:
            sheet = book.create_sheet()

        sheet.title = lang.upper()
        # switch language (FIXME: this is harder than it should be)
        request.environ['CKAN_LANG'] = lang
        handle_request(request, c)
        choice_fields = dict(
            (f['datastore_id'], f['choices'])
            for chromo in geno['resources']
            for f in recombinant_choice_fields(chromo['resource_name']))

        refs = []
        for chromo in geno['resources']:
            for field in chromo['fields']:
                _append_field_ref_rows(refs, field, link=None)

                if field['datastore_id'] in choice_fields:
                    _append_field_choices_rows(
                        refs,
                        choice_fields[field['datastore_id']],
                        full_text_choices=False)

        _populate_reference_sheet(sheet, geno, refs)
        sheet = None

    return book
Beispiel #6
0
    def __before__(self, action, **params):
        c.__timer = time.time()
        c.__version__ = ckan.__version__
        app_globals.app_globals._check_uptodate()

        self._identify_user()

        i18n.handle_request(request, c)

        maintain.deprecate_context_item('new_activities',
                                        'Use `h.new_activities` instead.')

        # Prevents the variable interfering with the root_path logic
        if 'SCRIPT_NAME' in request.environ:
            request.environ['SCRIPT_NAME'] = ''
Beispiel #7
0
    def __before__(self, action, **params):
        c.__timer = time.time()
        c.__version__ = ckan.__version__
        app_globals.app_globals._check_uptodate()
        self._identify_user()
        i18n.handle_request(request, c)

        # If the user is logged in add their number of new activities to the
        # template context.
        if c.userobj:
            from ckan.logic import get_action

            new_activities_count = get_action("dashboard_new_activities_count")
            context = {"model": model, "session": model.Session, "user": c.user or c.author}
            c.new_activities = new_activities_count(context, {})
Beispiel #8
0
    def __before__(self, action, **params):
        c.__timer = time.time()
        c.__version__ = ckan.__version__
        app_globals.app_globals._check_uptodate()

        self._identify_user()

        i18n.handle_request(request, c)

        maintain.deprecate_context_item(
            'new_activities',
            'Use `h.new_activities` instead.')

        # Prevents the variable interfering with the root_path logic
        if 'SCRIPT_NAME' in request.environ:
            request.environ['SCRIPT_NAME'] = ''
Beispiel #9
0
    def __before__(self, action, **params):
        c.__timer = time.time()
        c.__version__ = ckan.__version__
        app_globals.app_globals._check_uptodate()
        self._identify_user()
        i18n.handle_request(request, c)

        # If the user is logged in add their number of new activities to the
        # template context.
        if c.userobj:
            from ckan.logic import get_action
            new_activities_count = get_action('dashboard_new_activities_count')
            context = {
                'model': model,
                'session': model.Session,
                'user': c.user or c.author
            }
            c.new_activities = new_activities_count(context, {})
Beispiel #10
0
 def __before__(self, action, **params):
     c.__version__ = ckan.__version__
     self._identify_user()
     i18n.handle_request(request, c)
Beispiel #11
0
 def __before__(self, action, **params):
     c.__version__ = ckan.__version__
     self._identify_user()
     i18n.handle_request(request, c)