-
Notifications
You must be signed in to change notification settings - Fork 4
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/form-filling-scenario-params-masking: #154
feature/form-filling-scenario-params-masking: #154
Conversation
Mikhail-Gl96
commented
Oct 26, 2023
- add masking for logging data_extracted_str
- add masking for logging data_extracted_str
@lru_cache | ||
def _get_common_masking_fields(user) -> list: | ||
"""Get global masking fields from user settings from file with name template_settings.""" | ||
return user.settings['template_settings'].get('masking_fields', []) if user is not None else [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
двойные кавычки пожалуйста
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -174,14 +176,25 @@ async def get_reply(self, user, text_preprocessing_result, reply_actions, field, | |||
user.last_scenarios.delete(self.id) | |||
return action_messages | |||
|
|||
@staticmethod | |||
@lru_cache | |||
def _get_common_masking_fields(user) -> list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return type - словарь
masking_fields в template_config словарь
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@lru_cache | ||
def _get_common_masking_fields(user) -> list: | ||
"""Get global masking fields from user settings from file with name template_settings.""" | ||
return user.settings['template_settings'].get('masking_fields', []) if user is not None else [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
дефолтное значение - словарь
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
def _get_masked_params(self, data: dict, user) -> dict: | ||
"""Masking data by global masking fields.""" | ||
masking_fields = self._get_common_masking_fields(user) | ||
return masking(data=deepcopy(data), masking_fields=masking_fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
masking не меняет передаваемый объект, поэтому deepcopy не нужен
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
- review fixes
* feature/form-filling-scenario-params-masking: - add masking for logging data_extracted_str * feature/form-filling-scenario-params-masking: - review fixes