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

Transition away from profiler fails on unsaved changes check #940

Closed
jw3 opened this issue Nov 1, 2023 · 1 comment · Fixed by #941
Closed

Transition away from profiler fails on unsaved changes check #940

jw3 opened this issue Nov 1, 2023 · 1 comment · Fixed by #941
Labels
bug Something isn't working

Comments

@jw3
Copy link
Member

jw3 commented Nov 1, 2023

The logic looking at unsaved changes causes failure when navigating away from the profiler page.

  1. Navigate to the profiler
  2. Navigate away from the profiler
  3. Observe stack trace
Traceback (most recent call last):
  File "/usr/lib64/python3.11/site-packages/fapolicy_analyzer/ui/main_window.py", line 479, in on_configAdminMenu_activate
    self.__pack_main_content(router(PAGE_SELECTION.CONFIG))
  File "/usr/lib64/python3.11/site-packages/fapolicy_analyzer/ui/main_window.py", line 180, in __pack_main_content
    if hasattr(self.__page, "_unsaved_changes") and self.__page._unsaved_changes:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/events/events.py", line 93, in __getattr__
    raise EventsException("Event '%s' is not declared" % name)
events.events.EventsException: Event '_unsaved_changes' is not declared

main_window.py", line 180

ht: #916 (reply in thread)

#921

@jw3
Copy link
Member Author

jw3 commented Nov 1, 2023

This issue was weird because it only failed on some UI pages. Looking at the events code

events.py 91

        if hasattr(self, '__events__'):
            if name not in self.__events__:
                raise EventsException("Event '%s' is not declared" % name)

So if the page had declared an __events__ list, the thing has to be in it, otherwise its happy to just introspect the properties of the object.

@jw3 jw3 closed this as completed in #941 Nov 1, 2023
jw3 added a commit that referenced this issue Nov 1, 2023
Explicitly declare the `_unsaved_changes` event on the profiler page to
satisfy events.py introspection

Closes #940
@jw3 jw3 added the bug Something isn't working label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant