wiki: Handle wiki_edit_age or wiki_edit_karma being None.

This commit is contained in:
Andre D
2012-10-01 12:04:28 -05:00
committed by Neil Williams
parent b4feef712b
commit c2b56ba6f9
2 changed files with 4 additions and 3 deletions

View File

@@ -117,12 +117,12 @@ def may_revise(sr, user, page=None):
return True
karma = max(user.karma('link', sr), user.karma('comment', sr))
if karma < sr.wiki_edit_karma:
if karma < (sr.wiki_edit_karma or 0):
# If the user has too few karma, they should not contribute
return False
age = (datetime.datetime.now(g.tz) - user._date).days
if age < sr.wiki_edit_age:
if age < (sr.wiki_edit_age or 0):
# If they user's account is too young
# They should not contribute
return False

View File

@@ -102,7 +102,8 @@ class Subreddit(Thing, Printable):
allow_comment_gilding=True,
)
_essentials = ('type', 'name', 'lang')
_data_int_props = Thing._data_int_props + ('mod_actions', 'reported')
_data_int_props = Thing._data_int_props + ('mod_actions', 'reported',
'wiki_edit_karma', 'wiki_edit_age')
sr_limit = 50
gold_limit = 100