clear-skies 1.19.9__py3-none-any.whl → 1.19.10__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.

Potentially problematic release.


This version of clear-skies might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clear-skies
3
- Version: 1.19.9
3
+ Version: 1.19.10
4
4
  Summary: A framework for building backends in the cloud
5
5
  Home-page: https://github.com/cmancone/clearskies
6
6
  License: MIT
@@ -55,7 +55,7 @@ clearskies/backends/restful_api_advanced_search_backend.py,sha256=uiR4SEKhLNmczY
55
55
  clearskies/backends/secrets_backend.py,sha256=4lzrgdL_O_pgCT5HknV2gotFgp9GzjQ5_2n0-4H4kvs,2204
56
56
  clearskies/binding_config.py,sha256=bF8LBNEgJacwKCqToAtDqN9hv5omzU7zt_4qB9KPtE0,457
57
57
  clearskies/column_types/__init__.py,sha256=QHEFFd3wRXvaOR7uZk-bpVLlLoTiN3D4S8sBU9rFwCE,4330
58
- clearskies/column_types/audit.py,sha256=kYCjEDXx6VLjdGSTN05AE10OBj2RDyvsDCVrhPR86wE,8259
58
+ clearskies/column_types/audit.py,sha256=klAXnwKjqmNCJqQcBWH5WYPEAZdEblTQTwpcEQAAbqE,8636
59
59
  clearskies/column_types/belongs_to.py,sha256=tH1tbTOfjifSNuVjO-KbMF7GiUIoLfcDItrrS3TGGM8,11044
60
60
  clearskies/column_types/boolean.py,sha256=1yyM1CUfgD84pPE65c1OP1Qjf_J0Z45hjPrDR51AUkQ,1878
61
61
  clearskies/column_types/category_tree.py,sha256=PgNmzZPyqYS5NADH_QTCxLvDXZFxzv5ESKTkvPrrLXo,9140
@@ -199,7 +199,7 @@ clearskies/tests/simple_api/models/__init__.py,sha256=nUA0W6fgXw_Bxa9CudkaDkC80t
199
199
  clearskies/tests/simple_api/models/status.py,sha256=PEhPbaQh5qdUNHp8O0gz91LOLENAEBtqSaHxUPXchaM,699
200
200
  clearskies/tests/simple_api/models/user.py,sha256=5_P4Tp1tTdX7PkMJ__epPM5MA7JAeVYGas69vcWloLc,819
201
201
  clearskies/tests/simple_api/users_api.py,sha256=KYXCgEofDxHeRdQK67txN5oYUPvxxmB8JTku7L-apk4,2344
202
- clear_skies-1.19.9.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
203
- clear_skies-1.19.9.dist-info/METADATA,sha256=UafNzDmV9XcXfih62yaNTv3P15ItNVC0Mgvu501WneU,1366
204
- clear_skies-1.19.9.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
205
- clear_skies-1.19.9.dist-info/RECORD,,
202
+ clear_skies-1.19.10.dist-info/LICENSE,sha256=3Ehd0g3YOpCj8sqj0Xjq5qbOtjjgk9qzhhD9YjRQgOA,1053
203
+ clear_skies-1.19.10.dist-info/METADATA,sha256=THacV02HYXH5BgFDcRNABBcNWZSLPe7_6XzyuU7n7fc,1367
204
+ clear_skies-1.19.10.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
205
+ clear_skies-1.19.10.dist-info/RECORD,,
@@ -29,6 +29,9 @@ class Audit(has_many.HasMany):
29
29
  With `exclude_columns` you can specify some names of columns to ignore. If an update happens and only columns
30
30
  in `exclude_columns` are being set, then a history entry will not be created. Also, these columns will
31
31
  not be included in the audit record.
32
+
33
+ With `mask_columns` you can specify the names of columns which should be noted as updated in the audit record,
34
+ but the actual values (before and after) should not be recorded.
32
35
  """
33
36
 
34
37
  _parent_columns = None
@@ -40,6 +43,7 @@ class Audit(has_many.HasMany):
40
43
  my_configs = [
41
44
  "child_models_class",
42
45
  "exclude_columns",
46
+ "mask_columns",
43
47
  "foreign_column_name",
44
48
  "is_readable",
45
49
  "readable_child_columns",
@@ -92,21 +96,21 @@ class Audit(has_many.HasMany):
92
96
  + " but it has something else"
93
97
  )
94
98
 
95
- if "exclude_columns" in configuration:
96
- exclude_columns = configuration["exclude_columns"]
97
- if not hasattr(exclude_columns, "__iter__"):
98
- raise ValueError(
99
- f"{error_prefix} 'exclude_columns' should be an iterable " + "with the list of columns to exclude."
100
- )
101
- if isinstance(exclude_columns, str):
99
+ for config_name in ["exclude_columns", "mask_columns"]:
100
+ if config_name not in configuration:
101
+ continue
102
+
103
+ config_columns = configuration[config_name]
104
+ if not hasattr(config_columns, "__iter__"):
105
+ raise ValueError(f"{error_prefix} '{config_name}' should be an iterable with the list of column names.")
106
+ if isinstance(config_columns, str):
102
107
  raise ValueError(
103
- f"{error_prefix} 'exclude_columns' should be an iterable "
104
- + "with the list of child columns to output."
108
+ f"{error_prefix} '{config_name}' should be an iterable " + "with a list of column names."
105
109
  )
106
- for column_name in exclude_columns:
110
+ for column_name in config_columns:
107
111
  if column_name not in parent_columns:
108
112
  raise ValueError(
109
- f"{error_prefix} 'exclude_columns' references column named '{column_name}' but this"
113
+ f"{error_prefix} '{config_name}' references column named '{column_name}' but this"
110
114
  + " column does not exist in the original model class."
111
115
  )
112
116
 
@@ -118,6 +122,7 @@ class Audit(has_many.HasMany):
118
122
  old_data = model._previous_data
119
123
  new_data = model._data
120
124
  exclude_columns = self.config("exclude_columns")
125
+ mask_columns = self.config("mask_columns")
121
126
  parent_columns = self.parent_columns
122
127
 
123
128
  if not old_data:
@@ -152,6 +157,9 @@ class Audit(has_many.HasMany):
152
157
  **to_data,
153
158
  **parent_columns[column].to_json(model),
154
159
  }
160
+ if column in mask_columns:
161
+ to_data[column] = "****"
162
+ from_data[column] = "****"
155
163
  if not from_data and not to_data:
156
164
  return
157
165