You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem Statement
As I added simple history to existing project I am often dealing with a situation that I see history change but it have blank change_reason and I don't know where it came from.
Optimally I would like to see full trace from the save() up.
I tried to add the _change_reason to various places in the code, but it could take quite some time to have it everywhere regardless the burden it would add to the code.
I would like to have _change_reason only on places in the code where it brings some additional benefit over just knowing where the change came from.
Describe the solution you'd like
I am not sure what the correct solution is. I am sure that for example introducing new field with full trace could be too expensive for many of the current implementations.
This functionality could have been made somehow optional, for example as some parameter to HistoricalRecords.
Also there is possibility to just fill in something to the _change_reason if it is blank.
I have found a way to do this as a bit dirty hotfix in my project just by adding this code to /history_register/__init__.py:
importtracebackfromsimple_historyimportutils# Modify get_change_message to include change reason_original_get_change_reason_from_object=utils.get_change_reason_from_objectdefget_change_reason_from_object(obj):
original_reason=_original_get_change_reason_from_object(obj)
ifnotoriginal_reason:
blenderhub_ts= []
fortintraceback.format_stack():
if"/blenderhub"intand"/history_register/"notint:
blenderhub_ts.append(
t.split("apps/")[-1].split(", in")[0].replace('", line ', ":").strip()
)
return"|".join(blenderhub_ts)[-100:]
returnoriginal_reasonutils.get_change_reason_from_object=get_change_reason_from_object
The text was updated successfully, but these errors were encountered:
Problem Statement
As I added simple history to existing project I am often dealing with a situation that I see history change but it have blank
change_reason
and I don't know where it came from.Optimally I would like to see full trace from the save() up.
I tried to add the
_change_reason
to various places in the code, but it could take quite some time to have it everywhere regardless the burden it would add to the code.I would like to have
_change_reason
only on places in the code where it brings some additional benefit over just knowing where the change came from.Describe the solution you'd like
I am not sure what the correct solution is. I am sure that for example introducing new field with full trace could be too expensive for many of the current implementations.
This functionality could have been made somehow optional, for example as some parameter to
HistoricalRecords
.Also there is possibility to just fill in something to the
_change_reason
if it is blank.I have found a way to do this as a bit dirty hotfix in my project just by adding this code to
/history_register/__init__.py
:The text was updated successfully, but these errors were encountered: