Skip to content

update url for fgp viewer#1678

Open
RabiaSajjad wants to merge 2 commits into
masterfrom
fgp_viewer
Open

update url for fgp viewer#1678
RabiaSajjad wants to merge 2 commits into
masterfrom
fgp_viewer

Conversation

@RabiaSajjad

Copy link
Copy Markdown
Member

No description provided.

@RabiaSajjad RabiaSajjad requested a review from JVickery-TBS June 5, 2026 18:13
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
300 1 299 0
View the top 1 failed test(s) by shortest run time
ckanext/canada/tests/test_validators.py::TestNAVLSchema::test_validation_options
Stack Traces | 0.055s run time
self = <ckanext.canada.tests.test_validators.TestNAVLSchema object at 0x7efe31137a30>

    def test_validation_options(self):
        "creating a resource with lax validation options should remove them"
>       pkg = self.sysadmin_action.package_create(**self.complete_pkg)

.../canada/tests/test_validators.py:457: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../ckanapi/ckanapi/common.py:60: in action
    return self._ckan.call_action(name, data_dict=kwargs)
.../ckanapi/ckanapi/localckan.py:74: in call_action
    return self._get_action(action)(context, data_dict)
.../ckan/logic/__init__.py:581: in wrapped
    result = _action(context, data_dict, **kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = {'__auth_audit': [], '__auth_user_obj_checked': True, 'auth_user_obj': <User id=5b56d850-f0eb-4bbc-ac7a-2154be029340 n...n.com/137/291 plugin_extras=None>, 'model': <module 'ckan.model' from '.../ckan/model/__init__.py'>, ...}
data_dict = {'collection': 'primary', 'date_published': '2013-01-01', 'frequency': 'as_needed', 'imso_approval': 'true', ...}

    def package_create(
            context: Context, data_dict: DataDict) -> ActionResult.PackageCreate:
        '''Create a new dataset (package).
    
        You must be authorized to create new datasets. If you specify any groups
        for the new dataset, you must also be authorized to edit these groups.
    
        Plugins may change the parameters of this function depending on the value
        of the ``type`` parameter, see the
        :py:class:`~ckan.plugins.interfaces.IDatasetForm` plugin interface.
    
        :param name: the name of the new dataset, must be between 2 and 100
            characters long and contain only lowercase alphanumeric characters,
            ``-`` and ``_``, e.g. ``'warandpeace'``
        :type name: string
        :param title: the title of the dataset (optional, default: same as
            ``name``)
        :type title: string
        :param private: If ``True`` creates a private dataset
        :type private: bool
        :param author: the name of the dataset's author (optional)
        :type author: string
        :param author_email: the email address of the dataset's author (optional)
        :type author_email: string
        :param maintainer: the name of the dataset's maintainer (optional)
        :type maintainer: string
        :param maintainer_email: the email address of the dataset's maintainer
            (optional)
        :type maintainer_email: string
        :param license_id: the id of the dataset's license, see
            :py:func:`~ckan.logic.action.get.license_list` for available values
            (optional)
        :type license_id: license id string
        :param notes: a description of the dataset (optional)
        :type notes: string
        :param url: a URL for the dataset's source (optional)
        :type url: string
        :param version: (optional)
        :type version: string, no longer than 100 characters
        :param state: the current state of the dataset, e.g. ``'active'`` or
            ``'deleted'``, only active datasets show up in search results and
            other lists of datasets, this parameter will be ignored if you are not
            authorized to change the state of the dataset (optional, default:
            ``'active'``)
        :type state: string
        :param type: the type of the dataset (optional),
            :py:class:`~ckan.plugins.interfaces.IDatasetForm` plugins
            associate themselves with different dataset types and provide custom
            dataset handling behaviour for these types
        :type type: string
        :param resources: the dataset's resources, see
            :py:func:`resource_create` for the format of resource dictionaries
            (optional)
        :type resources: list of resource dictionaries
        :param tags: the dataset's tags, see :py:func:`tag_create` for the format
            of tag dictionaries (optional)
        :type tags: list of tag dictionaries
        :param extras: the dataset's extras (optional), extras are arbitrary
            (key: value) metadata items that can be added to datasets, each extra
            dictionary should have keys ``'key'`` (a string), ``'value'`` (a
            string)
        :type extras: list of dataset extra dictionaries
        :param plugin_data: private package data belonging to plugins.
            Only sysadmin users may set this value. It should be a dict that can
            be dumped into JSON, and plugins should namespace their data with the
            plugin name to avoid collisions with other plugins, eg::
    
                {
                    "name": "test-dataset",
                    "plugin_data": {
                        "plugin1": {"key1": "value1"},
                        "plugin2": {"key2": "value2"}
                    }
                }
        :type plugin_data: dict
        :param relationships_as_object: see :py:func:`package_relationship_create`
            for the format of relationship dictionaries (optional)
        :type relationships_as_object: list of relationship dictionaries
        :param relationships_as_subject: see :py:func:`package_relationship_create`
            for the format of relationship dictionaries (optional)
        :type relationships_as_subject: list of relationship dictionaries
        :param groups: the groups to which the dataset belongs (optional), each
            group dictionary should have one or more of the following keys which
            identify an existing group:
            ``'id'`` (the id of the group, string), or ``'name'`` (the name of the
            group, string),  to see which groups exist
            call :py:func:`~ckan.logic.action.get.group_list`
        :type groups: list of dictionaries
        :param owner_org: the id of the dataset's owning organization, see
            :py:func:`~ckan.logic.action.get.organization_list` or
            :py:func:`~ckan.logic.action.get.organization_list_for_user` for
            available values. This parameter can be made optional if the config
            option :ref:`ckan.auth.create_unowned_dataset` is set to ``True``.
        :type owner_org: string
    
        :returns: the newly created dataset (unless 'return_id_only' is set to True
                  in the context, in which case just the dataset id will
                  be returned)
        :rtype: dictionary
    
        '''
        model = context['model']
        user = context['user']
    
        if 'type' not in data_dict:
            package_plugin = lib_plugins.lookup_package_plugin()
            try:
                # use first type as default if user didn't provide type
                package_type = package_plugin.package_types()[0]
            except (AttributeError, IndexError):
                package_type = 'dataset'
                # in case a 'dataset' plugin was registered w/o fallback
                package_plugin = lib_plugins.lookup_package_plugin(package_type)
            data_dict['type'] = package_type
        else:
            package_plugin = lib_plugins.lookup_package_plugin(data_dict['type'])
    
        schema: Schema = context.get(
            'schema') or package_plugin.create_package_schema()
    
        _check_access('package_create', context, data_dict)
    
        if 'api_version' not in context:
            # check_data_dict() is deprecated. If the package_plugin has a
            # check_data_dict() we'll call it, if it doesn't have the method we'll
            # do nothing.
            check_data_dict = getattr(package_plugin, 'check_data_dict', None)
            if check_data_dict:
                try:
                    check_data_dict(data_dict, schema)
                except TypeError:
                    # Old plugins do not support passing the schema so we need
                    # to ensure they still work
                    package_plugin.check_data_dict(data_dict)
    
        data, errors = lib_plugins.plugin_validate(
            package_plugin, context, data_dict, schema, 'package_create')
        log.debug('package_create validate_errs=%r user=%s package=%s data=%r',
                  errors, context.get('user'),
                  data.get('name'), data_dict)
    
        if errors:
            model.Session.rollback()
>           raise ValidationError(errors)
E           ckan.logic.ValidationError: None - {'resources': [{'id': ['Resource id already exists.']}]}

.../logic/action/create.py:203: ValidationError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@JVickery-TBS JVickery-TBS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RabiaSajjad okay so openmaps would be https://open.canada.ca/openmaps ?? I think this would work then as our nginx rewrites the portal /data to / and then the ckan helper would resolve to /openmaps right?

I guess I will take note that in the Combined CKAN instance, I will have to change the if fgp_url to if not h.is_registry_domain() and fgp_url so that the openmaps button does not display in the Registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants