On 07/11/2013 05:10 PM, Tomas Babej wrote:
>
> On Thursday 11 of July 2013 16:10:33 Ana Krivokapic wrote:
>
> > On 07/11/2013 11:20 AM, Tomas Babej wrote:
>
> > > boolean_var = {}
>
> > > - for var in ('persistent_search', 'serial_autoincrement'):
>
> > > + for var in ('serial_autoincrement'):
>
> > This won't work - a one element tuple needs a comma at the end:
>
> > ('serial_autoincrement', )
>
> > > boolean_var[var] = "yes" if getattr(self, var, False) else "no"
>
> > >
>
> > > self.sub_dict = dict(FQDN=self.fqdn,
>
> > > @@ -607,9 +604,8 @@ class BindInstance(service.Service):
>
> > > SUFFIX=self.suffix,
>
> > > OPTIONAL_NTP=optional_ntp,
>
> > > ZONEMGR=self.zonemgr,
>
> > > - ZONE_REFRESH=self.zone_refresh,
>
> > > IPA_CA_RECORD=ipa_ca,
>
> > > - PERSISTENT_SEARCH=boolean_var['persistent_search'],
>
> > > + PERSISTENT_SEARCH="yes",
>
> > > SERIAL_AUTOINCREMENT=boolean_var['serial_autoincrement'],)
>
> >
>
> > But anyway, I think this piece of code is unnecessarily complicated, I 
> > don't see
>
> > a need for the 'boolean_var' dict here. I would suggest replacing it with
>
> > something like:
>
> >
>
> > serial_autoincrement = "yes" if self.serial_autoincrement else "no"
>
> >
>
> > and then pass serial_autoincrement to self.sub_dict = dict(...)
>
> >
>
> >
>
>  
>
> Attached patch refactored the relevant part of the code.
>
>  
>
> Tomas
>

ACK

-- 
Regards,

Ana Krivokapic
Associate Software Engineer
FreeIPA team
Red Hat Inc.

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to