Skip to content

Commit

Permalink
Added a new_comment function to the post class that allows users to p…
Browse files Browse the repository at this point in the history
…ost commets via post objects rather than invoking it through the API. Also, added a new attribute cleanup rule that strips whitespace from the beginning and end of body attributes.
  • Loading branch information
thomasw committed Apr 24, 2010
1 parent 2e4a181 commit 4f23354
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyposterous/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def update_post(self, media=None):
if self.body:
kwargs['body'] = self.body

self.api.update_post(**kwargs)
return self.api.update_post(**kwargs)

def new_comment(self, body, name=None, email=None, date=None):
return self.api.new_comment(self.id, body, name, email, date)

class Comment(PosterousData):
pass
Expand All @@ -56,4 +59,5 @@ class Media(PosterousData):
# the value
attribute_map = {
('id', 'views', 'filesize', 'height', 'width', 'commentscount', 'num_posts',):int,
('private', 'commentsenabled', 'primary'):bool_string,}
('private', 'commentsenabled', 'primary'):bool_string,
('body',):lambda x: x.strip()} # Hopefully whitespace will not be significant.

0 comments on commit 4f23354

Please sign in to comment.