diff options
author | Blake DeMarcy <ofunknowndescent@gmail.com> | 2017-04-29 20:48:38 -0500 |
---|---|---|
committer | Blake DeMarcy <ofunknowndescent@gmail.com> | 2017-04-29 20:48:38 -0500 |
commit | e673706ae52460507040e83a3428185eb53996bf (patch) | |
tree | e8c32c58dfd51dd6aebb7a3190e9cfb642d8ffe9 /server.py | |
parent | d5ae142a7f9dc382c06dca424973f4345b181c5b (diff) | |
download | bbj-e673706ae52460507040e83a3428185eb53996bf.tar.gz |
add option to include ops with index (or only ops with gets)
Diffstat (limited to 'server.py')
-rw-r--r-- | server.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -241,8 +241,13 @@ class API(object): """ Return an array with all the threads, ordered by most recent activity. Requires no arguments. + + Optionally, you may supply the argument `include_op`, which, when non-nil, + will include a "messages" key with the object, whose sole content is the + original message (post_id 0). """ - threads = db.thread_index(database) + op = isinstance(args, dict) and args.get("include_op") + threads = db.thread_index(database, include_op=op) cherrypy.thread_data.usermap = create_usermap(database, threads, True) return threads @@ -328,9 +333,13 @@ class API(object): Requires the argument `thread_id`. `format` may also be specified as a formatter to run the messages through. Currently only "sequential" is supported. + + You may also supply the parameter `op_only`. When it's value + is non-nil, the messages array will only include post_id 0 (the first) """ validate(args, ["thread_id"]) - thread = db.thread_get(database, args["thread_id"]) + thread = db.thread_get( + database, args["thread_id"], op_only=args.get("op_only")) cherrypy.thread_data.usermap = \ create_usermap(database, thread["messages"]) do_formatting(args.get("format"), thread["messages"]) |