← Back to team overview

configglue team mailing list archive

[Bug 753395] [NEW] Update to schema definition syntax

 

Public bug reported:

Currently sections are defined as local variables in the class scope
when defining schema. This approach works, but the sections are not
visually distinct from each other. Better approach would be to use
inner classes to achieve the scoping of options. An example:

    class ASchema(Schema):

        class database(Section):
            host = StringOption()
            port = IntOption()
            username = StringOption()
            password = StringOption()

        class login(Section):
            url = StringOption()
            access_token = StringOption()

instead of current:

    class ASchema(Schema):

        database = ConfigSection()
        database.host = StringOption()
        database.port = IntOption()
        database.username = StringOption()
        database.password = StringOption()

        login = ConfigSection()
        login.url = StringOption()
        login.access_token = StringOption()

** Affects: configglue
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of
Configglue developers, which is the registrant for configglue.
https://bugs.launchpad.net/bugs/753395

Title:
  Update to schema definition syntax

Status in configglue:
  New

Bug description:
  Currently sections are defined as local variables in the class scope
  when defining schema. This approach works, but the sections are not
  visually distinct from each other. Better approach would be to use
  inner classes to achieve the scoping of options. An example:

      class ASchema(Schema):

          class database(Section):
              host = StringOption()
              port = IntOption()
              username = StringOption()
              password = StringOption()

          class login(Section):
              url = StringOption()
              access_token = StringOption()

  instead of current:

      class ASchema(Schema):

          database = ConfigSection()
          database.host = StringOption()
          database.port = IntOption()
          database.username = StringOption()
          database.password = StringOption()

          login = ConfigSection()
          login.url = StringOption()
          login.access_token = StringOption()



Follow ups

References