Permalink
Browse files

Convert approved_by and banned_by fields to redditor objects

  • Loading branch information...
1 parent 273bb76 commit 1c49c5c89c03a0bfb4be69ae502c662515a7d079 @bboe bboe committed Apr 2, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 reddit/objects.py
View
@@ -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."""
@@ -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)

0 comments on commit 1c49c5c

Please sign in to comment.