Uploaded image for project: 'Nuxeo Python Client'
  1. Nuxeo Python Client
  2. NXPY-144

Add the @since decorator

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Do
    • Affects Version/s: NoVersionApplicable
    • Fix Version/s: NoVersionApplicable
    • Component/s: Core
    • Tags:
    • Team:
      DRIVE
    • Story Points:
      2

      Description

      The idea is to be able to alert the developer that a given API is not available on the server in use.

      For instance, if the server version is 9.10, then Comment API is not available. And that code will always fail:

      doc.comments()
      doc.comment("My new comment")
      

      I the server.log, such errors will be visible:

      Service comment not found for object: /nuxeo/site/api/v1 of type APIRoot
      Service comment not found for object: /nuxeo/site/api/v1/id/<DOCUID> of type Documen
      

      To prevent that, I propose to create a @since decorator used for each and every method to specifiy the minimum server version:

      @since("10.3")
      def comment(self, ...):
          pass
      
      @since("10.3")
      def comments(self, ...):
          pass
      

      The decorator will have access to the current server version (not yet decided how) and will raise a custom exception.

        Attachments

          Activity

            People

            • Assignee:
              mschoentgen Mickaël Schoentgen
              Reporter:
              mschoentgen Mickaël Schoentgen
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 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 - 15 minutes
                15m