Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request HubSpot#10 from aaylward/master
Browse files Browse the repository at this point in the history
fixing parameter names
  • Loading branch information
prior committed Dec 15, 2011
2 parents 53cf6e6 + b501b91 commit dce436e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions hapi/blog.py
Expand Up @@ -48,16 +48,14 @@ def create_post(self, blog_guid, author_name, author_email, title, summary, cont
raw_response = self._call('%s/posts.json' % blog_guid, data=post, method='POST', content_type='application/json', raw_output=True, **options)
return raw_response

def update_post(self, post_guid, title = None, summary = None, content = None, meta_desc = None, meta_keyword = None, tags = [], **options):
params = self.update_post.func_code.co_varnames[1:self.update_post.func_code.co_argcount]
params_in_use = {}
for param in params:
if eval(param):
params_in_use[param] = eval(param)
post = json.dumps(params_in_use)
def update_post(self, post_guid, title=None, summary=None, content=None, meta_desc=None, meta_keyword=None, tags=None, **options):
tags = tags or []
update_param_translation = dict(title='title', summary='summary', content='body', meta_desc='metaDescription', meta_keyword='metaKeywords', tags='tags')
post_dict = dict([(k,locals()[p]) for p,k in update_param_translation.iteritems() if locals().get(p)])
post = json.dumps(post_dict)
raw_response = self._call('posts/%s.json' % post_guid, data=post, method='PUT', content_type='application/json', raw_output=True, **options)
return raw_response

def publish_post(self, post_guid, should_notify, publish_time = None, is_draft = 'false', **options):
post = json.dumps(dict(
published = publish_time,
Expand Down

0 comments on commit dce436e

Please sign in to comment.