Skip to content

Commit

Permalink
Make add and add_attrs chainable.
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Nov 3, 2010
1 parent 206446e commit 461e7c2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kml.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ def add_attrs(self, *args, **kwargs):
for arg in args:
self.attrs.update(arg)
self.attrs.update(kwargs)
return self

def add(self, *args, **kwargs):
"""Add children."""
self.children.extend(list(arg for arg in args if not arg is None))
for key, value in kwargs.items():
self.children.append(class_by_name[key](value))
return self

def write(self, file):
"""Write self to file."""
Expand Down

0 comments on commit 461e7c2

Please sign in to comment.