def __init__( self, rd=None, # OBSOLETE total=0, prog=None, # OBSOLETE do_markup=True, conv=None, rating_converter=None, name="importer", ): """rd is our recipeData instance. Total is used to keep track of progress. do_markup should be True if instructions and modifications come to us unmarked up (i.e. if we need to escape < and &, etc. -- this might be False if importing e.g. XML). """ timeaction = TimeAction("importer.__init__", 10) if not conv: self.conv = convert.get_converter() self.id_converter = {} # a dictionary for tracking named IDs self.total = total if prog or rd: import traceback traceback.print_stack() if prog: print "WARNING: ", self, "handed obsolete parameter prog=", prog if rd: print "WARNING: ", self, "handed obsolete parameter rd=", rd self.do_markup = do_markup self.count = 0 self.rd = get_recipe_manager() self.rd_orig_ing_hooks = self.rd.add_ing_hooks self.added_recs = [] self.added_ings = [] # self.rd_orig_hooks = self.rd.add_hooks self.rd.add_ing_hooks = [] # self.rd.add_hooks = [] self.position = 0 self.group = None # allow threaded calls to pause self.suspended = False # allow threaded calls to be terminated (this # has to be implemented in subclasses). self.terminated = False # Our rating converter -- if we've been handed a class, we # assume our caller will handle doing the # conversion. Otherwise we do it ourselves. if rating_converter: self.rating_converter = rating_converter self.do_conversion = False else: self.rating_converter = RatingConverter() self.do_conversion = True self.km = keymanager.get_keymanager() timeaction.end() SuspendableThread.__init__(self, name=name)
def __init__( self, rd=None, # OBSOLETE total=0, prog=None, # OBSOLETE do_markup=True, conv=None, rating_converter=None, name='importer'): """rd is our recipeData instance. Total is used to keep track of progress. do_markup should be True if instructions and modifications come to us unmarked up (i.e. if we need to escape < and &, etc. -- this might be False if importing e.g. XML). """ timeaction = TimeAction('importer.__init__', 10) if not conv: self.conv = convert.get_converter() self.id_converter = {} # a dictionary for tracking named IDs self.total = total if prog or rd: import traceback traceback.print_stack() if prog: print('WARNING: ', self, 'handed obsolete parameter prog=', prog) if rd: print('WARNING: ', self, 'handed obsolete parameter rd=', rd) self.do_markup = do_markup self.count = 0 self.rd = get_recipe_manager() self.rd_orig_ing_hooks = self.rd.add_ing_hooks self.added_recs = [] self.added_ings = [] #self.rd_orig_hooks = self.rd.add_hooks self.rd.add_ing_hooks = [] #self.rd.add_hooks = [] self.position = 0 self.group = None # allow threaded calls to pause self.suspended = False # allow threaded calls to be terminated (this # has to be implemented in subclasses). self.terminated = False # Our rating converter -- if we've been handed a class, we # assume our caller will handle doing the # conversion. Otherwise we do it ourselves. if rating_converter: self.rating_converter = rating_converter self.do_conversion = False else: self.rating_converter = RatingConverter() self.do_conversion = True self.km = keymanager.get_keymanager() timeaction.end() SuspendableThread.__init__(self, name=name)