Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-1091

Create the tooltip decorator

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.3
    • Fix Version/s: 3.0.5
    • Component/s: Framework
    • Tags:
    • Sprint:
      nxDrive 10.1.4
    • Story Points:
      1

      Description

      currently, the code is too verbose when using Action:

      def _setup_watchdog(self):
          self._action = Action('Setup Watchdog')
          try:
              ...
          finally:
              self._end_action()
      

      Using a simple decorator like this one:

      def action(doing):
          @wrapt.decorator
          def wrapper(wrapped, instance, args, kwargs):
              Action(doing)
              try:
                  yield wrapped(*args, **kwargs)
              finally:
                  Action.finish_action()
      
          return wrapper
      

      Is better and easier to use:

      @action('Setup Watchdog')
      def _setup_watchdog(self): ...
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h