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

Adds new type of dialect for SIP2 servers that require spaces instead… #1495

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

dbernstein
Copy link
Contributor

@dbernstein dbernstein commented Nov 1, 2023

… of zeros in the time zone segment of the date time values sent via the SIP2 protocol.

Description

Motivation and Context

https://ebce-lyrasis.atlassian.net/browse/PP-546

How Has This Been Tested?

Manually test in addition to the unit tests.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (710219c) 90.38% compared to head (0a75fe1) 90.38%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1495   +/-   ##
=======================================
  Coverage   90.38%   90.38%           
=======================================
  Files         232      232           
  Lines       29341    29347    +6     
  Branches     6855     6856    +1     
=======================================
+ Hits        26519    26525    +6     
  Misses       1799     1799           
  Partials     1023     1023           
Flag Coverage Δ
Api 73.76% <90.90%> (+<0.01%) ⬆️
Core 60.99% <0.00%> (-0.02%) ⬇️
migration 29.29% <27.27%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
api/sip/__init__.py 98.77% <ø> (ø)
api/sip/client.py 96.05% <100.00%> (+0.02%) ⬆️
api/sip/dialect.py 89.47% <85.71%> (+2.80%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

self.dialect_config = dialect.config

if isinstance(dialect, str):
self.dialect_config = Dialect(dialect).config
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fix here also addresses a problem with the AG Verso dialect. Without this conversion from a string value to the enum an exception will be thrown when trying to access the non-existent property.

Copy link
Member

Choose a reason for hiding this comment

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

This is a good catch @dbernstein.

I spent a bit of time looking into it, and this is actually a more pervasive issue then just in this integration. Instead of adding the code to deal with the dialect coming in as a string here, I'd rather deal with the up-steam cause so that we get the correct enum type passed in here.

I pushed a new PR here that should do that: #1500

Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

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

This looks good @dbernstein! Just a couple comments.

@@ -120,6 +120,7 @@ class SIP2Settings(BasicAuthProviderSettings):
options={
Sip2Dialect.GENERIC_ILS: "Generic ILS",
Sip2Dialect.AG_VERSO: "Auto-Graphics VERSO",
Sip2Dialect.TZ_SPACES: "TZ Spaces",
Copy link
Member

Choose a reason for hiding this comment

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

I know there was some discussion of this in the ticket, I think this would be better named Folio then TZ Spaces. I pinged Carissa and Courtney on the ticket for some feedback from their perspective.

self.dialect_config = dialect.config

if isinstance(dialect, str):
self.dialect_config = Dialect(dialect).config
Copy link
Member

Choose a reason for hiding this comment

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

This is a good catch @dbernstein.

I spent a bit of time looking into it, and this is actually a more pervasive issue then just in this integration. Instead of adding the code to deal with the dialect coming in as a string here, I'd rather deal with the up-steam cause so that we get the correct enum type passed in here.

I pushed a new PR here that should do that: #1500

now = utc_now()
return datetime.datetime.strftime(now, "%Y%m%d0000%H%M%S")
zzzz = " " * 4 if tz_spaces else "0" * 4
return datetime.datetime.strftime(now, f"%Y%m%d{zzzz}%H%M%S")
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a small test for this that makes sure now() formats the date as we would expect based on the dialect selected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

… of zeros in the time zone segment of the date time values sent via the SIP2 protocol.
* Use "FOLIO" rather than "TZ SPACES" as dialect name
* Revert dialect type check in sip client since new changes in the main obviate the need for them.
@dbernstein
Copy link
Contributor Author

@jonathangreen : I believe I've addressed your change requests. I believe this one can be merged.

@dbernstein dbernstein closed this Nov 6, 2023
@dbernstein dbernstein reopened this Nov 6, 2023
Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

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

Looks good!

@dbernstein dbernstein merged commit 4763d83 into main Nov 6, 2023
38 checks passed
@dbernstein dbernstein deleted the PP-546-fix-folio branch November 6, 2023 20:48
@jonathangreen jonathangreen added the feature New feature label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants