Skip to content

Commit

Permalink
Convert approved_by and banned_by fields to redditor objects
Browse files Browse the repository at this point in the history
  • Loading branch information
bboe committed Apr 2, 2012
1 parent 273bb76 commit 1c49c5c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions reddit/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from reddit.helpers import (_get_section, _get_sorter, _modify_relationship,
_request)

REDDITOR_KEYS = ('approved_by', 'author', 'banned_by', 'redditor')


class RedditContentObject(object):
"""Base class that represents actual reddit objects."""
Expand Down Expand Up @@ -72,8 +74,8 @@ def __getattr__(self, attr):
def __setattr__(self, name, value):
if value and name == 'subreddit':
value = Subreddit(self.reddit_session, value, fetch=False)
elif value and name in ['redditor', 'author']:
if value == '[deleted]':
elif value and name in REDDITOR_KEYS:
if not value or value == '[deleted]':
value = None
else:
value = Redditor(self.reddit_session, value, fetch=False)
Expand Down

0 comments on commit 1c49c5c

Please sign in to comment.