def get(self, args):            
        self.validateAPIKey()
        session = self.application.dm.Session()
        if args is not None:
            args = urllib.unquote(args)
            arglist = args.split('/')
            arglist = filter(None, arglist)
            argcount = len(arglist)
        else:
            arglist = list()
            argcount = 0
            
        folder_list = self.application.config['general']['folder_list']

        response = {
            'current' : "",
            'folders' : [],
            'comics' : {
                'url_path' : "",
                'count' : 0
            }   
        }       
        if argcount == 0:
            # just send the list of root level folders
            for idx, val in enumerate(folder_list):
                item = {
                    'name': val,
                    'url_path' : "/folders/" + str(idx)
                }   
                response['folders'].append(item)
            
        else:
            try:
                # need to validate the first arg is an index into the list
                folder_idx = int(arglist[0])
                if len(folder_list) >= folder_idx:
                    raise Exception

                # build up a folder by combining the root folder with the following path
                path = os.path.join(folder_list[folder_idx], *arglist[1:] )
                # validate *that* folder
                if not os.path.exists(path):
                    print "Not exist", path, type(path)            
                    raise Exception
                

                response['current'] = path
                # create a list of subfolders    
                for o in os.listdir(path):
                    if os.path.isdir(os.path.join(path,o)):
                        sub_path = u"/folders" + args + u"/" + o
                        sub_path = urllib.quote(sub_path.encode("utf-8"))
                        item = {
                            'name': o,
                            'url_path' : sub_path
                            }   
                        response['folders'].append(item)
                # see if there are any comics here
                response['comics']['count'] = session.query(Comic).filter(Comic.folder == path).count()
                comic_path = u"/comiclist?folder=" + urllib.quote(u"{0}".format(path).encode('utf-8'))
                response['comics']['url_path'] = comic_path

            except FloatingPointError as e:
                print e
                raise tornado.web.HTTPError(404, "Unknown folder")
 
        self.setContentType()
        self.write(response)
dataset/ETHPy150Open beville/ComicStreamer/comicstreamerlib/server.py/FolderAPIHandler.get/swapped operands of `>=`