def set (self, **kwargs):
"""Set several properties of the underlying object
at one go. This is particularly useful in combination
with the new () method below. However, an instance
which has been spawned in this way won't have enough
information to write pack, so only try if the
instance has a path.
"""
if kwargs:
try:
for attribute, value in kwargs.items ():
if attribute in self.properties:
self._cached_properties (attribute).set (value)
else:
raise AttributeError (attribute)
#
# Only try to write the attributes
# back if the object exists.
#
if self.ole_object.Path_.Path:
self.ole_object.Put_ ()
except pywintypes.com_error:
handle_com_error ()
评论列表
文章目录