Add :callback for JSONP calls
parent
226441d821
commit
484432d804
|
@ -50,6 +50,7 @@ The arguments are:
|
||||||
- `theforce`: force download the rss feed
|
- `theforce`: force download the rss feed
|
||||||
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging)
|
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging)
|
||||||
- http server only
|
- http server only
|
||||||
|
- `callback=NAME`: for JSONP calls
|
||||||
- `cors`: allow Cross-origin resource sharing (allows XHR calls from other servers)
|
- `cors`: allow Cross-origin resource sharing (allows XHR calls from other servers)
|
||||||
- `html`: changes the http content-type to html, so that python cgi erros (written in html) are readable in a web browser
|
- `html`: changes the http content-type to html, so that python cgi erros (written in html) are readable in a web browser
|
||||||
- `txt`: changes the http content-type to txt (for faster "`view-source:`")
|
- `txt`: changes the http content-type to txt (for faster "`view-source:`")
|
||||||
|
|
|
@ -693,7 +693,9 @@ def After(rss, options):
|
||||||
if item.content:
|
if item.content:
|
||||||
item.content = conv.handle(item.content)
|
item.content = conv.handle(item.content)
|
||||||
|
|
||||||
if options.json:
|
if re.match(r'^[a-zA-Z0-9\.]+$', options.callback) is not None:
|
||||||
|
return '%s(%s)' % (options.callback, rss.tojson())
|
||||||
|
elif options.json:
|
||||||
if options.indent:
|
if options.indent:
|
||||||
return rss.tojson(indent=4)
|
return rss.tojson(indent=4)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue