feeds: use FeddJSON for .tojson()

Clean up related code
master
pictuga 2020-03-18 16:31:36 +01:00
parent 2dd9ae202d
commit e3528a8f36
1 changed files with 1 additions and 19 deletions

View File

@ -20,12 +20,6 @@ from wheezy.template.ext.core import CoreExtension
json.encoder.c_make_encoder = None
try:
from collections import OrderedDict
except ImportError:
# python < 2.7
from ordereddict import OrderedDict
try:
from StringIO import StringIO
from urllib2 import urlopen
@ -86,8 +80,7 @@ class ParserBase(object):
pass
def tojson(self, indent=None):
# TODO temporary
return json.dumps(OrderedDict(self.iterdic()), indent=indent)
return self.convert(FeedJSON).tostring()
def tocsv(self):
# TODO temporary
@ -126,17 +119,6 @@ class ParserBase(object):
return target
def iterdic(self):
for element in self.dic:
value = getattr(self, element)
if element == 'items':
value = [OrderedDict(x.iterdic()) for x in value]
elif isinstance(value, datetime):
value = value.isoformat()
yield element, value
# RULE-BASED FUNCTIONS
def rule_search(self, rule):