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

Introduce specific getters and setters for database

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.3
    • Fix Version/s: 4.1.0
    • Component/s: Framework

      Description

      To retreive a parameter's value from the database, we are using:

      dao.get_config("remote_token")  # string or None
      dao.get_config("ssl_verify", "1") != "0"  # bool

       
      As we saw with NXDRIVE-1490, we also have:

      dao.get_config("ssl_verify", default=True)

       
      Which is not intuitive: asking for a boolean as the default value is suggesting but the database stores only integers returned as strings.

      So the prevent such errors/misuses, we should introduce specific getters:

      dao.get_int("param", default=0)
      dao.get_bool("param", default=False)

      We keep dao.get_config() to retreive other values.

      And so for setters:

      dao.store_int("param", 42)
      dao.store_bool("param", True)

      We keep dao.update_config() to store other values.

       

        Attachments

          Issue Links

            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