[PATCH] Port of dsdb, dsdb_dns and samdb Python modules

Andrew Bartlett abartlet at samba.org
Fri Feb 9 18:01:24 UTC 2018


On Fri, 2018-02-09 at 18:29 +0100, Lumir Balhar wrote:
> On 02/08/2018 10:10 PM, Andrew Bartlett wrote:
> > Sorry to nitpick, but why do we need the addCleanup and the tearDown?
> > 
> > On Thu, 2018-02-08 at 10:56 +0100, Andreas Schneider wrote:
> > > +    def tearDown(self):
> > > +        delete_force(self.samdb, self.account_dn)
> > 
> > At worse it doesn't do anything, but this looks wrong.
> > 
> > I'm just waiting for a reply from Lumir regarding this and I can give
> > my review:
> 
> Sorry for the delay. I just forgot to remove debug print. Attaching the 
> new patchset based on the latest one in this thread. Is it okay or 
> should I change something else?

Yes, I was hoping you could clarify here (and probably in the commit
message) why there is no common way to do this:

-            pw = unicode('"' + password.encode('utf-8') + '"', 'utf-8').encode('utf-16-le')
+
+            if PY3:
+                pw = str('"' + password + '"').encode('utf-16-le')
+            else:
+                pw = unicode('"' + password.encode('utf-8') + '"', 'utf-8').encode('utf-16-le')

The 'if PY3:' stuff just bothers me because we will live with it
forever, and if we must do it I would prefer it in a helper function
somewhere. 

Thanks,

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba-technical mailing list