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

swisscovery: remove << and >> characters in the title when importing #781

Merged
merged 1 commit into from
Mar 1, 2022

Conversation

Garfield-fr
Copy link
Contributor

Co-Authored-by: Bertrand Zuchuat bertrand.zuchuat@rero.ch

How to test?

  • Add a deposit and import source swisscovery with identifier: 2070406237

Code review check list

  • Commit message template compliance.
  • Commit message without typos.
  • File names.
  • Functions names.
  • Functions docstrings.
  • Unnecessary commited files?
  • Extracted translations?

@Garfield-fr Garfield-fr self-assigned this Feb 16, 2022
@Garfield-fr Garfield-fr force-pushed the zub-swisscovery-remove-chars branch 2 times, most recently from a5299cd to 57c552d Compare February 21, 2022 07:34
@@ -66,8 +68,18 @@ def get_record():

record = SRUSchema().dump(record)

# Remove << and >> in the title value
pattern = re.compile('<<(.+)>>', re.S)
if 'title' in record:
Copy link
Contributor

Choose a reason for hiding this comment

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

You can write something like:

for title in record.get('title',[]):
    for mainTitle in title.get('mainTitle', []):
        ....

def test_title_remove_char(client, submitter):
"""Test for the removal of << and >> characters in the title."""
login_user_via_session(client, email=submitter['email'])
res = client.get(url_for('swisscovery.get_record',query='2070406237'))
Copy link
Contributor

Choose a reason for hiding this comment

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

space is missing

@Garfield-fr Garfield-fr force-pushed the zub-swisscovery-remove-chars branch 2 times, most recently from be49f15 to ac87eb4 Compare February 22, 2022 07:39
@pronguen pronguen self-requested a review February 24, 2022 11:15
@@ -66,8 +68,15 @@ def get_record():

record = SRUSchema().dump(record)

# Remove << and >> in the title value
Copy link
Contributor

Choose a reason for hiding this comment

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

The command or function is not correct. The regexp removes all << ??? >>>!

* Closes rero#701.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
@Garfield-fr Garfield-fr merged commit cff08da into rero:staging Mar 1, 2022
@Garfield-fr Garfield-fr deleted the zub-swisscovery-remove-chars branch March 8, 2022 05:59
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.

Import from swisscovery: some << and >> characters should be removed from the title
5 participants