예제 #1
0
 def update_directories(self,update_dir_list):
     res_future = Future()
     res = {}
     for dirpath in update_dir_list:
         dir_list = []
         file_list = []
         try:
             for i in common.get_dir_contents(self.current_user, dirpath):
                 if i[0].startswith('.'):
                     continue
                 if i[2]:
                     dir_list.append(tuple(list(i)+[i[0].lower()]))
                     # dir_list.append(i)
                 else:
                     file_list.append(tuple(list(i)+[i[0].lower()]))
                     # file_list.append(i)
             # dir_list.sort()
             # file_list.sort()
             dir_list = sorted(dir_list,key=operator.itemgetter(3))
             file_list = sorted(file_list,key=operator.itemgetter(3))
             res.update({dirpath:dir_list+file_list})
         except common.MissingFileError:
             continue
     res_future.set_result(res)
     return res_future
예제 #2
0
 def get(self):
     dirpath = self.get_argument('dirpath')
     dir_list = []
     file_list = []
     for i in common.get_dir_contents(self.current_user, dirpath):
         if i[0].startswith('.'):
             continue
         if i[2]:
             dir_list.append(tuple(list(i)+[i[0].lower()]))
             # dir_list.append(i)
         else:
             file_list.append(tuple(list(i)+[i[0].lower()]))
             # file_list.append(i)
     dir_list = sorted(dir_list,key=operator.itemgetter(3))
     file_list = sorted(file_list,key=operator.itemgetter(3))
     # dir_list.sort()
     # file_list.sort()
     self.write(dict(dir_contents=dir_list+file_list))