Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/py3 #53

Merged
merged 82 commits into from
Aug 10, 2021
Merged

Feature/py3 #53

merged 82 commits into from
Aug 10, 2021

Conversation

nickumia-reisys
Copy link
Contributor

I'm creating this PR a little early so that we have a somewhat good way to track changes from main. There were a few files that I broke up completely, for example, ckanext/usmetadata/plugin.py because it needed to be updated from controllers to blueprints and, since that's a big change, I stripped out constants into a separate file. Those constants are pretty important, but because I did that, we can't track the changes to those constants too well from this.

Either way, this is a huge upgrade. ... more comments to follow..

…erator' linting errors, so we are going to just ignore them; I thought these were originally strings which is why I attempted to join them, but they are some form of lists
…for this extension; started to fix py3 errors, but a lot of them stem from controller to blueprint issue, so trying to make fresh slate for that commit
…f things no longer existing and/or being rewritten, will try to see how the tests do..
…e to 'fanstatic' directory; fixed template reference to dashboard home (following example in 'ckanext-datagovtheme' ./ckanext/datagovtheme/templates/templates_2_8/header.html:46)
…en though I'm not using it directly; the 'before_search' function in the plugin is causing an issue because there is no good way to verify a user is authorized right now
…ally; fixed lint; these changes will change a lot of the plugin functionality...
… taken which may cause incomplete data uploads; but until we know the proper way to update the validation, this was deemed the best approach
…est_validate_dataset_action and added additional validation tests as referenced in TODO
…he rest of the tests;... well... lint passes and the tests seem to work on CKAN 2.8.... moving on to CKAN 2.9 now? :s"
@nickumia-reisys
Copy link
Contributor Author

This PR is to complete this issue.

@nickumia-reisys
Copy link
Contributor Author

@mogul Please remove the circleci checks 😅

@mogul
Copy link

mogul commented Aug 3, 2021

@mogul Please remove the circleci checks 😅

Done.

@nickumia-reisys
Copy link
Contributor Author

Bug Found via dcat_usmetadata testing:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

regex_candidate = <ckan.lib.navl.dictization_functions.Missing object at 0x7f980c22a8d0>

    def bureau_code_validator(regex_candidate):
        validator = re.compile(r'^\d{3}:\d{2}(\s*,\s*\d{3}:\d{2}\s*)*$')
>       if isinstance(validator.match(regex_candidate), type(re.match("", ""))):
E       TypeError: expected string or buffer

src/ckanext-usmetadata/ckanext/usmetadata/plugin/helper.py:26: TypeError

Will fix now..

@mogul mogul requested a review from jbrown-xentity August 5, 2021 20:16
jbrown-xentity
jbrown-xentity previously approved these changes Aug 6, 2021
Copy link

@jbrown-xentity jbrown-xentity left a comment

Choose a reason for hiding this comment

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

Most of these comments are minor tweaks/changes, great work!


converted_data, errors = df.validate(data, schema)

# TODO: schema approach was changed, so we don't care if it's missing right now

Choose a reason for hiding this comment

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

Can we add what the desired functionality is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

ADR.md Outdated

### Consequences

- Until the schema is updated properly, incomplete input data may cause unknown bugs throughout the system.

Choose a reason for hiding this comment

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

This is a little vague and harsh. I would say "until the schema is properly updated, users may be able to input data that is not exportable in the data.json file. Due to the limited number of users and very little new users, this risk was deemed acceptable."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed.

ADR.md Outdated
Custom vaildator functions were written to handle the functionality that the imported validators provided. The following link was used as a reference,
- https://docs.ckan.org/en/2.9/extensions/adding-custom-fields.html#custom-validators
The validators were not registered with the plugin because the place where they were defined was already importing the plugin, so there would have
been a circular dependency. Either way, the validators work as standalong functions that get called.

Choose a reason for hiding this comment

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

standalone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch 😄

ADR.md Outdated

### Consequences

- The string_length_validator has known issues where sometimes it allows strings that are longer than allowed. However, as a unit test, the function works.

Choose a reason for hiding this comment

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

We fixed this, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

@@ -0,0 +1,17 @@
ARG CKAN_VERSION=2.8

Choose a reason for hiding this comment

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

Do we want to try to remove this whole file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add this to the ADR.

requirements.txt Outdated
@@ -1 +1,7 @@
flake8

Choose a reason for hiding this comment

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

Shouldn't these be in a requirements-dev.txt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add the dev-requirements.txt file

Copy link

@jbrown-xentity jbrown-xentity left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, looks great!

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.

3 participants