Refactored Settings Defaults

I refactored how settings and their defaults are done so that the default is in exactly one place.  Also, as I was adding a setting, our check for cyclomatic complexity prohibited having the chain of if-elif for validation, so I refactored validating settings to call subfunctions.  I also added methods to get the default value of a setting and to check if a setting was using its default value (which is distinct from just having the default value).
Will do.

On Thu, Sep 25, 2014 at 2:27 PM, Zach Mullen <notifications@github.com>
wrote:

> In girder/models/setting.py:
>
> >          else:
> >              raise ValidationException(
> >                  'Invalid setting key "{}".'.format(key), 'key')
> >
> >          return doc
> >
> > -    def get(self, key, default=None):
> > +    def validate_core_plugins_enabled(self, doc):
> > +        if not type(doc['value']) is list:
> > +            raise ValidationException(
> > +                'Plugins enabled setting must be a list.', 'value')
> > +
> > +    def validate_core_cookie_lifetime(self, doc):
>
> Let's name it girder.utility.camelcase, we can put it in *init*.py there.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/girder/girder/pull/359/files#r18050016>.
>