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

Commit

Permalink
Provide developer-friendly attributes in the modaction json.
Browse files Browse the repository at this point in the history
  • Loading branch information
bboe authored and spladug committed Jan 28, 2013
1 parent a4ee8b2 commit 173135d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions r2/r2/lib/jsontemplates.py
Expand Up @@ -720,10 +720,20 @@ def thing_attr(self, thing, attr):
class ModActionTemplate(ThingJsonTemplate):
_data_attrs_ = dict(sr_id36='sr_id36',
mod_id36='mod_id36',
id='_fullname',
subreddit='sr_name',
mod='author',
created_utc='date',
action='action',
details='details',
description='description',
target_fullname='target_fullname')

def thing_attr(self, thing, attr):
if attr == 'date':
return (time.mktime(thing.date.astimezone(pytz.UTC).timetuple())
- time.timezone)
return ThingJsonTemplate.thing_attr(self, thing, attr)

def kind(self, wrapped):
return 'modaction'

0 comments on commit 173135d

Please sign in to comment.