From 4a328b5629db121accd81de9ced4c4d69b038f9a Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sat, 16 Jun 2012 07:37:35 -0700 Subject: Some simple fixes that will make the python 3 translation easier --- cloudinit/user_data.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cloudinit/user_data.py') diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py index 9915b8b0..866bf6de 100644 --- a/cloudinit/user_data.py +++ b/cloudinit/user_data.py @@ -68,7 +68,8 @@ INCLUSION_TYPES_MAP = { } # Sorted longest first -INCLUSION_SRCH = sorted(INCLUSION_TYPES_MAP.keys(), key=(lambda e: 0 - len(e))) +INCLUSION_SRCH = sorted(list(INCLUSION_TYPES_MAP.keys()), + key=(lambda e: 0 - len(e))) # Various special content types TYPE_NEEDED = ["text/plain", "text/x-not-multipart"] @@ -193,7 +194,7 @@ class UserDataProcessor(object): msg.add_header('Content-Disposition', 'attachment', filename=ent['filename']) - for header in ent.keys(): + for header in list(ent.keys()): if header in ('content', 'filename', 'type'): continue msg.add_header(header, ent['header']) @@ -363,7 +364,7 @@ def convert_string(raw_data, headers=None): data = util.decomp_str(raw_data) if "mime-version:" in data[0:4096].lower(): msg = email.message_from_string(data) - for (key, val) in headers.items(): + for (key, val) in headers.iteritems(): if key in msg: msg.replace_header(key, val) else: -- cgit v1.2.3