diff options
-rw-r--r-- | cgi/api.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -371,6 +371,20 @@ def api_process(self, path_split): values['post_url'] = post_url values['time_taken'] = ttaken + elif method == 'newThreads': + data_limit = formdata.get('limit') + limit = 30 + if data_limit: + try: + limit = int(data_limit) + except ValueError: + raise APIError, "Limit must be numeric" + + if limit > 30: + raise APIError, "Maximum limit is 30" + + threads = getNewThreads(limit) + values['threads'] = threads else: raise APIError, "Invalid method" |