#24 Join some system paths using os.path.join instead of string concatenation
Closed: Fixed 7 years ago Opened 7 years ago by ilias95.


Metadata Update from @ilias95:
- Issue assigned to ilias95

7 years ago

I think it works with just:

os.path.join(self.krb_prefix, 'usr/sbin/kadmin.local')

Which might be nicer to read and maintain :)

I think that the whole point of using os.path.join is to avoid putting any slashes in the path to make the program platform independent. If we don't care for this that's fine.

Apart from this, the one you wrote wouldn't work because self.krb_prefix is en empty string at the moment, which would result in a relative path:

>>> os.path.join('', 'usr/sbin/kadmin.local')
'usr/sbin/kadmin.local'

But it can work like this:

os.path.join(os.path.sep, self.krb_prefix, 'usr/sbin/kadmin.local')

If we don't really care for it being platform independent we may as well ignore it and leave it as it is.

I think that we have no interest in supporting this library on windows at the moment, so yeah, I don't mind this at all.

I thought that python also knew in most calls to translate / to \ for windows anyway.

I think I prefix the option you present at the end here. Thanks!

Metadata Update from @firstyear:
- Custom field Review Status adjusted to ack

7 years ago

commit 0fe0ea9
To ssh://git@pagure.io/lib389.git
2da3366..0fe0ea9 master -> master

Metadata Update from @firstyear:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

7 years ago

Login to comment on this ticket.

Metadata