#!/usr/bin/python
-from helpers import Item, _stringify, json_loads
+import simplejson
+
+from tornado.database import Row
class News(object):
- def __init__(self, filename=None):
+ def __init__(self, application, filename=None):
+ self.application = application
self.items = []
if filename:
data = data.replace("\n", "").replace("\t", " ")
- json = json_loads(data)
+ json = simplejson.loads(data)
for key in sorted(json.keys()):
json[key]["id"] = key
- self.items.append(NewsItem(**_stringify(json[key])))
+ self.items.append(Row(json[key]))
def get(self, limit=None):
ret = self.items[:]
if limit:
ret = ret[:limit]
return ret
-
-
-NewsItem = Item
-
-news = News("news.json")