folio-migration-tools 1.10.0b4__py3-none-any.whl → 1.10.0b6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -115,6 +115,10 @@ class UserMapper(MappingFileMapperBase):
115
115
 
116
116
  if self.task_config.remove_request_preferences:
117
117
  del clean_folio_object["requestPreference"]
118
+
119
+ if self.task_config.remove_username:
120
+ del clean_folio_object["username"]
121
+
118
122
  self.report_folio_mapping_no_schema(clean_folio_object)
119
123
  self.report_legacy_mapping_no_schema(legacy_user)
120
124
 
@@ -4,7 +4,6 @@ import json
4
4
  import logging
5
5
  import re
6
6
  import sys
7
- import time
8
7
  import traceback
9
8
  from datetime import datetime, timezone
10
9
  from typing import TYPE_CHECKING, Annotated, List, Optional
@@ -792,18 +791,19 @@ class BatchPoster(MigrationTaskBase):
792
791
  )
793
792
 
794
793
  def do_post(self, batch):
795
- url = self.api_info["api_endpoint"]
796
- if self.api_info["object_name"] == "users":
797
- payload = {self.api_info["object_name"]: list(batch), "totalRecords": len(batch)}
798
- elif self.api_info["total_records"]:
799
- payload = {"records": list(batch), "totalRecords": len(batch)}
800
- else:
801
- payload = {self.api_info["object_name"]: batch}
802
- return self.folio_client.folio_post(
803
- url,
804
- payload,
805
- query_params=self.query_params,
806
- )
794
+ with self.folio_client.get_folio_http_client() as http_client:
795
+ url = self.api_info["api_endpoint"]
796
+ if self.api_info["object_name"] == "users":
797
+ payload = {self.api_info["object_name"]: list(batch), "totalRecords": len(batch)}
798
+ elif self.api_info["total_records"]:
799
+ payload = {"records": list(batch), "totalRecords": len(batch)}
800
+ else:
801
+ payload = {self.api_info["object_name"]: batch}
802
+ return http_client.post(
803
+ url,
804
+ json=payload,
805
+ params=self.query_params,
806
+ )
807
807
 
808
808
  def get_current_record_count_in_folio(self):
809
809
  if "query_endpoint" in self.api_info:
@@ -99,6 +99,7 @@ class MigrationTaskBase:
99
99
  raise NotImplementedError()
100
100
 
101
101
  def clean_out_empty_logs(self):
102
+ _close_handler(self.data_issue_file_handler)
102
103
  if (
103
104
  self.folder_structure.data_issue_file_path.is_file()
104
105
  and os.stat(self.folder_structure.data_issue_file_path).st_size == 0
@@ -260,13 +261,13 @@ class MigrationTaskBase:
260
261
 
261
262
  # Data issue file formatter
262
263
  data_issue_file_formatter = logging.Formatter("%(message)s")
263
- data_issue_file_handler = logging.FileHandler(
264
+ self.data_issue_file_handler = logging.FileHandler(
264
265
  filename=str(self.folder_structure.data_issue_file_path), mode="w"
265
266
  )
266
- data_issue_file_handler.addFilter(LevelFilter(26))
267
- data_issue_file_handler.setFormatter(data_issue_file_formatter)
268
- data_issue_file_handler.setLevel(26)
269
- logging.getLogger().addHandler(data_issue_file_handler)
267
+ self.data_issue_file_handler.addFilter(LevelFilter(26))
268
+ self.data_issue_file_handler.setFormatter(data_issue_file_formatter)
269
+ self.data_issue_file_handler.setLevel(26)
270
+ logging.getLogger().addHandler(self.data_issue_file_handler)
270
271
  logger.info("Logging set up")
271
272
 
272
273
  def setup_records_map(self, mapping_file_path):
@@ -553,3 +554,10 @@ class LevelFilter(logging.Filter):
553
554
 
554
555
  def filter(self, record):
555
556
  return record.levelno == self.level
557
+
558
+
559
+ def _close_handler(handler: logging.Handler | None):
560
+ if handler is None:
561
+ return
562
+ handler.flush()
563
+ handler.close()
@@ -101,6 +101,16 @@ class UserTransformer(MigrationTaskBase):
101
101
  ),
102
102
  ),
103
103
  ] = False
104
+ remove_username: Annotated[
105
+ Optional[bool],
106
+ Field(
107
+ title="Remove username",
108
+ description=(
109
+ "Specify whether to remove username. Resulting objects are not compatible with"
110
+ " the mod-user-import. Optional, by default is False"
111
+ ),
112
+ ),
113
+ ] = False
104
114
 
105
115
  @staticmethod
106
116
  def get_object_type() -> FOLIONamespaces:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: folio-migration-tools
3
- Version: 1.10.0b4
3
+ Version: 1.10.0b6
4
4
  Summary: A tool allowing you to migrate data from legacy ILS:s (Library systems) into FOLIO LSP
5
5
  Keywords: FOLIO,ILS,LSP,Library Systems,MARC21,Library data
6
6
  Author: Theodor Tolstoy, Lisa Sjögren, Brooks Travis, Jeremy Nelson, Clinton Bradford
@@ -22,7 +22,7 @@ folio_migration_tools/mapping_file_transformation/notes_mapper.py,sha256=vCmZmjr
22
22
  folio_migration_tools/mapping_file_transformation/order_mapper.py,sha256=VUcbeBGlQ7KsDPgJlaOOe8bO0y5IRLTCBH_IQKcaqiA,18267
23
23
  folio_migration_tools/mapping_file_transformation/organization_mapper.py,sha256=MKlN3doQ_R-Y3klkbCFL4qHUfhMATBsIhvq1jpmajqQ,14641
24
24
  folio_migration_tools/mapping_file_transformation/ref_data_mapping.py,sha256=rROcBiL5TE7bWsJ95A6shurPZ1e4In6PTwR5BN9amzU,8991
25
- folio_migration_tools/mapping_file_transformation/user_mapper.py,sha256=13cvFr7Vp6uxZNpAmLxGvPVLC1_En2NVvLtuP75HAzU,8846
25
+ folio_migration_tools/mapping_file_transformation/user_mapper.py,sha256=nqyoSQAo3IGAAzXVRM-R0M5Q83zS3uU6jvKx4_c1mt8,8940
26
26
  folio_migration_tools/marc_rules_transformation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  folio_migration_tools/marc_rules_transformation/conditions.py,sha256=-5U6nBGcBO49C9MMyxOL2wMhHGxUawkIM9e-MwNaM_4,46938
28
28
  folio_migration_tools/marc_rules_transformation/holdings_statementsparser.py,sha256=-mOGtoPa3qmEqGWtyBTN-fQ743ZmT8caDLc9ES9J74Y,13667
@@ -35,7 +35,7 @@ folio_migration_tools/marc_rules_transformation/rules_mapper_bibs.py,sha256=F8tK
35
35
  folio_migration_tools/marc_rules_transformation/rules_mapper_holdings.py,sha256=YILyEfO-LkQPk-4OjiuY68X5xDA0LlI7UUp7_mvzLUE,29184
36
36
  folio_migration_tools/migration_report.py,sha256=B8e4tMfT0xCJ3BxkSg7ZZJYmg0VLQVXmmVnWwmojZD4,4260
37
37
  folio_migration_tools/migration_tasks/__init__.py,sha256=ZkbY_yGyB84Ke8OMlYUzyyBj4cxxNrhMTwQlu_GbdDs,211
38
- folio_migration_tools/migration_tasks/batch_poster.py,sha256=dIsqqjizuJN0BOj98uK4EsAQgdCcQwMwvK2CUtifd7w,46120
38
+ folio_migration_tools/migration_tasks/batch_poster.py,sha256=rbSx3dyF4UbNdFiAhBRDpBTvAwQI3BR4s4_sIBsM-70,46214
39
39
  folio_migration_tools/migration_tasks/bibs_transformer.py,sha256=zPxh2tjyqx88fuH1FuKLwhT6lhZ5fVTQAqE08IggYgM,6351
40
40
  folio_migration_tools/migration_tasks/courses_migrator.py,sha256=sKIeyUlc7o189lw88XbGILVkwnR9krqO0PgS-vLCCm8,7039
41
41
  folio_migration_tools/migration_tasks/holdings_csv_transformer.py,sha256=JzOufqjSR2V-gUvOq0pdQFsXjpxk1ldGJBQWIWGfCps,21915
@@ -43,12 +43,12 @@ folio_migration_tools/migration_tasks/holdings_marc_transformer.py,sha256=b1lWbY
43
43
  folio_migration_tools/migration_tasks/items_transformer.py,sha256=gIJ9SKUENE3OaEouGAFTsGjciN_YxwRoUAAEKJlfG-E,19498
44
44
  folio_migration_tools/migration_tasks/loans_migrator.py,sha256=6mwtA9-6B_pU1GKS9VD7Wu5stZ8YLlyeliFJhyPuho0,38785
45
45
  folio_migration_tools/migration_tasks/manual_fee_fines_transformer.py,sha256=CnmlTge7nChUJ10EiUkriQtJlVxWqglgfhjgneh2_yM,7247
46
- folio_migration_tools/migration_tasks/migration_task_base.py,sha256=yg96RuRHgapDHNjLE-1Fg_gpRmaRmVx7GUm45lHTIBY,22339
46
+ folio_migration_tools/migration_tasks/migration_task_base.py,sha256=rhIYFZ_dYWEyopkR2shht5ybKk4JQzxctSlBizml50g,22551
47
47
  folio_migration_tools/migration_tasks/orders_transformer.py,sha256=h8EyRbvbtwDZJq1y73J7oZFRdI1U4vq1Vrlay4GLf4M,13885
48
48
  folio_migration_tools/migration_tasks/organization_transformer.py,sha256=5s-ACb9-R8JLlPnROOq1ZnDIRCLQeWaxORDn0SrhQqs,16747
49
49
  folio_migration_tools/migration_tasks/requests_migrator.py,sha256=Q7sWOxqq73Fdg3Q1tmpvRxU9qhhG1BV3AGMoCMwh2cE,14768
50
50
  folio_migration_tools/migration_tasks/reserves_migrator.py,sha256=jdiwWAlMydXE2vlv0lgHRUljarslveyVOu-TCnymAEs,9953
51
- folio_migration_tools/migration_tasks/user_transformer.py,sha256=fWfcO9Njwpyt0-De3nhC_gMu_lHOEkhMdCRryXz3xcc,12241
51
+ folio_migration_tools/migration_tasks/user_transformer.py,sha256=apgVCoJQ4sB5aFp7p8FdSQrDfXSIzgEbEQ3C-6dG568,12621
52
52
  folio_migration_tools/task_configuration.py,sha256=6eqbjjSWfi-qgp0bhCsuBVE3gTK4HaXzXsAo68JPGc0,1146
53
53
  folio_migration_tools/transaction_migration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  folio_migration_tools/transaction_migration/legacy_loan.py,sha256=A5qvThfP3g62YnykLyti_tqTY7dq1SbLi3WZz7QXk6s,7399
@@ -56,7 +56,7 @@ folio_migration_tools/transaction_migration/legacy_request.py,sha256=Kv7jpBIuZ_q
56
56
  folio_migration_tools/transaction_migration/legacy_reserve.py,sha256=qzw0okg4axAE_ezXopP9gFsQ_e60o0zh7zqRzFBSWHY,1806
57
57
  folio_migration_tools/transaction_migration/transaction_result.py,sha256=cTdCN0BnlI9_ZJB2Z3Fdkl9gpymIi-9mGZsRFlQcmDk,656
58
58
  folio_migration_tools/translations/en.json,sha256=pS7dhHmj4XBqTcFNIcqFgRMY557fQan1RomdNg6PtdA,40941
59
- folio_migration_tools-1.10.0b4.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
60
- folio_migration_tools-1.10.0b4.dist-info/entry_points.txt,sha256=mJRRiCNP9j7_NpVXamHEiW8pDEjWQs1vEqD89G354cM,79
61
- folio_migration_tools-1.10.0b4.dist-info/METADATA,sha256=JlJpqIeLAOLOFk0kqT7_ZcS5pO-0o-NgaXlBPt2Kh7A,7162
62
- folio_migration_tools-1.10.0b4.dist-info/RECORD,,
59
+ folio_migration_tools-1.10.0b6.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
60
+ folio_migration_tools-1.10.0b6.dist-info/entry_points.txt,sha256=mJRRiCNP9j7_NpVXamHEiW8pDEjWQs1vEqD89G354cM,79
61
+ folio_migration_tools-1.10.0b6.dist-info/METADATA,sha256=EcDMNh4diSH6vDbrIQWdk-kcTdM2W2Agw3X4lo22h2Y,7162
62
+ folio_migration_tools-1.10.0b6.dist-info/RECORD,,