586 def validate_attributes(cls, bundle, item_id, attributes):
587 if attributes.get('delete', False):
588 for attr in attributes.keys():
589 if attr not in ['delete'] + list(BUILTIN_ITEM_ATTRIBUTES.keys()):590 raise BundleError(_(
591 "{item} from bundle '{bundle}' cannot have other "
592 "attributes besides 'delete'"
317 def validate_attributes(cls, bundle, item_id, attributes):
318 if attributes.get('delete', False):
319 for attr in attributes.keys():
320 if attr not in ['delete'] + list(BUILTIN_ITEM_ATTRIBUTES.keys()):321 raise BundleError(_(
322 "{item} from bundle '{bundle}' cannot have other "
323 "attributes besides 'delete'"
202 def validate_attributes(cls, bundle, item_id, attributes):
203 if attributes.get('delete', False):
204 for attr in attributes.keys():
205 if attr not in ['delete'] + list(BUILTIN_ITEM_ATTRIBUTES.keys()):206 raise BundleError(_(
207 "{item} from bundle '{bundle}' cannot have other "
208 "attributes besides 'delete'"
92 def validate_attributes(cls, bundle, item_id, attributes):
93 if attributes.get('delete', False):
94 for attr in attributes.keys():
95 if attr not in ['delete'] + list(BUILTIN_ITEM_ATTRIBUTES.keys()): 96 raise BundleError(_(
97 "{item} from bundle '{bundle}' cannot have other "
98 "attributes besides 'delete'"
Consider iterating the dictionary directly instead of calling .keys()
.
Using for key in dictionary
would always iterate the dictionary keys.
sounds = {"cow": "moo", "dog": "bark"}
for key in sounds.keys():
print(key)
sounds = {"cow": "moo", "dog": "bark"}
for key in sounds:
print(key)