예제 #1
0
 def bootstrap_sys_args(self):
     """Parsing sys arg parameters and store them
     """
     self.MODE = None
     self.params = get_checked_parameters()
     if not 'nt' in self.params:
         self.params['nt'] = Flag.ROOT
         self.MODE = Mode.VIEW
     self.nodeType = int(self.params['nt'])
     try:
         self.MODE = int(self.params['mode'])
     except:
         warn(self, "No 'mode' parameter")
     for p in self.params:
         info(self, "Param: %s = %s (%s)" % (p, str(self.params[p]),
                                             Flag.to_s(self.params['nt'])))
예제 #2
0
 def bootstrap_sys_args(self):
     """Parsing sys arg parameters and store them
     """
     self.MODE = None
     self.params = get_checked_parameters()
     if not 'nt' in self.params:
         self.params['nt'] = Flag.ROOT
         self.MODE = Mode.VIEW
     self.nodeType = int(self.params['nt'])
     try:
         self.MODE = int(self.params['mode'])
     except:
         warn(self, "No 'mode' parameter")
     for p in self.params:
         info(
             self, "Param: %s = %s (%s)" %
             (p, str(self.params[p]), Flag.to_s(self.params['nt'])))
예제 #3
0
 def populating(self,
                Dir,
                lvl=1,
                whiteFlag=None,
                blackFlag=None,
                gData=None):
     if Dir.Progress.iscanceled():
         return False
     if not gData:
         gData = {'count': 0, 'total': 100, 'startedOn': time()}
     if lvl != -1 and lvl < 1:
         return False
     Dir.update(gData, 'Fetching', '', '')
     if not (self.nt & blackFlag == self.nt):
         if not self.fetch(Dir, lvl, whiteFlag, blackFlag):
             return False
         else:
             self.__add_pagination(self.data)
     self.populate(Dir, lvl, whiteFlag, blackFlag)
     """ Recursive mode dont't decrement level """
     if lvl != -1:
         lvl -= 1
     label = self.get_label()
     gData['count'] = 0
     gData['total'] = len(self.childs)
     self.__add_pagination_node(Dir, lvl, whiteFlag)
     Dir.update(gData, 'Working', label, '')
     for child in self.childs:
         if Dir.is_canceled():
             return False
         """ Only white Flagged added to the listing """
         if child.nt & whiteFlag == child.nt:
             if not Dir.add_node(child):
                 warn(self, "Something went wrong... aborting")
                 self.childs = []
                 raise Qerror(who=self, what='build_down_abort')
             gData['count'] += 1
             Dir.update(gData, "Working", label, child.get_label())
         else:
             log(self, "Skipping node: %s" % (Flag.to_s(child.nt)))
         """ Calling builiding down on child """
         child.populating(Dir, lvl, whiteFlag, blackFlag, gData)
     return gData['count']
예제 #4
0
 def populating(self, Dir, lvl=1, whiteFlag=None, blackFlag=None,
                gData=None):
     if Dir.Progress.iscanceled():
         return False
     if not gData:
         gData = {'count': 0,
                  'total': 100,
                  'startedOn': time()}
     if lvl != -1 and lvl < 1:
         return False
     Dir.update(gData, 'Fetching', '', '')
     if not (self.nt & blackFlag == self.nt):
         if not self.fetch(Dir, lvl, whiteFlag, blackFlag):
             return False
         else:
             self.__add_pagination(self.data)
     self.populate(Dir, lvl, whiteFlag, blackFlag)
     """ Recursive mode dont't decrement level """
     if lvl != -1:
         lvl -= 1
     label = self.get_label()
     gData['count'] = 0
     gData['total'] = len(self.childs)
     self.__add_pagination_node(Dir, lvl, whiteFlag)
     Dir.update(gData, 'Working', label, '')
     for child in self.childs:
         if Dir.is_canceled():
             return False
         """ Only white Flagged added to the listing """
         if child.nt & whiteFlag == child.nt:
             if not Dir.add_node(child):
                 warn(self, "Something went wrong... aborting")
                 self.childs = []
                 raise Qerror(who=self, what='build_down_abort')
             gData['count'] += 1
             Dir.update(gData, "Working", label, child.get_label())
         else:
             log(self, "Skipping node: %s" % (Flag.to_s(child.nt)))
         """ Calling builiding down on child """
         child.populating(Dir, lvl, whiteFlag, blackFlag, gData)
     return gData['count']