libvirt-sandbox/image/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
libvirt-sandbox/image/cli.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
index d2035de..605183c 100644
--- a/libvirt-sandbox/image/cli.py
+++ b/libvirt-sandbox/image/cli.py
@@ -81,7 +81,7 @@ def prepare(args):
connect=args.connect)
def random_domain_name(tmpl):
- randomid = ''.join(random.choice(string.lowercase) for i in range(10))
+ randomid = ''.join(random.choice(string.ascii_lowercase) for i in range(10))
return re.sub('[^a-z0-9-]', '_', tmpl.path[1:], re.I) + ":" + randomid
def run(args):
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Mar 23, 2018 at 04:44:51PM +0000, Daniel P. Berrangé wrote:
>Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
ACK, but the commit message is misleading.
Python2 has ascii_lowercase as early as 2.2 and in Python3, lowercase
disappeared.
lowercase is the locale-dependent version, which seems to be identical
to ascii_lowercase for UTF-8 locales, but if you use a non-UTF one, fun
things happen:
>>> locale.setlocale(locale.LC_ALL, 'sk_SK')
'sk_SK'
>>> print string.lowercase
abcdefghijklmnopqrstuvwxyząłľśšşťźžżßŕáâăäĺćçčéęëěíîďđńňóôőöřůúűüýţ
Jano
>---
> libvirt-sandbox/image/cli.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
>index d2035de..605183c 100644
>--- a/libvirt-sandbox/image/cli.py
>+++ b/libvirt-sandbox/image/cli.py
>@@ -81,7 +81,7 @@ def prepare(args):
> connect=args.connect)
>
> def random_domain_name(tmpl):
>- randomid = ''.join(random.choice(string.lowercase) for i in range(10))
>+ randomid = ''.join(random.choice(string.ascii_lowercase) for i in range(10))
> return re.sub('[^a-z0-9-]', '_', tmpl.path[1:], re.I) + ":" + randomid
>
> def run(args):
>--
>2.14.3
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Sun, Mar 25, 2018 at 11:32:04AM +0200, Ján Tomko wrote: > On Fri, Mar 23, 2018 at 04:44:51PM +0000, Daniel P. Berrangé wrote: > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> > > ACK, but the commit message is misleading. > > Python2 has ascii_lowercase as early as 2.2 and in Python3, lowercase > disappeared. > > lowercase is the locale-dependent version, which seems to be identical > to ascii_lowercase for UTF-8 locales, but if you use a non-UTF one, fun > things happen: > > > > locale.setlocale(locale.LC_ALL, 'sk_SK') > 'sk_SK' > > > > print string.lowercase > abcdefghijklmnopqrstuvwxyząłľśšşťźžżßŕáâăäĺćçčéęëěíîďđńňóôőöřůúűüýţ Oh fun, we definitely should have used ascii_lowercase from the start then. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.